When accessing my site, the user has to enter his credentials. They are basically plain directory access credentials. At a certain point I check if a certain file they want to download exists by calling
WebRequest req = HttpWebRequest.Create(checkUri.AbsoluteUri);
WebResponse res = req.GetResponse();
Although I can access the checkUri from the browser, I get a 401 when doing the above check. I think I have to set the
req.Credentials
But I don't know where the current credentials are stored...
Any ideas?
--Update--
- Integrated Windows Authentication: No
- Allow Anonymous: Off
- Caler: Link on page of same site (GET)
- Impersonation: default is off (don't even know how to enable it in asp.net mvc)