Hello,
I have a file in a folder on the server.
If i give anonymous access to the folder anyone can access it so i denied anonymous access and i am trying to open it for registered users with forms authentication.

But when i am trying to access it with correct credentials it is throwing a 401 unauthorized error.


this is the code :

context.Response.ClearHeaders();
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(RETURNURL);
req.Credentials = new NetworkCredential("id", "pwd");
WebResponse resp = req.GetResponse();


if i give anonymous access to the folder then i am able to access the pdf file and open it in the browser.
Please please help.