I am trying to access the route service ,but while doing so I get the following error.
Edit: The first example in the browser probably should have actually worked if the proxy was working correctly, because if I sign-in, I can see the service with the f=json
I'm not 100% sure what your question is. In the first example, it looks like you are trying to access the service REST endpoint directly in the browser, which should not work as I believe the services directory is locked down for security reasons. In the second example, you are looking at the results of the routing service request, which should work fine (and does).
Another option would be to use the ArcGIS Online hosted proxy for tasks like routing:
We use this now with the RouteTask sample: