I am making a page in SharePoint that is used to proxy other content in SharePoint. The user is authenticated at the time they hit this proxy page, but I am getting an Unauthorized Access error.
The page has the following code behind:
var request = (HttpWebRequest) WebRequest.Create(urlToProxy);
request.Method = "GET";
request.Credentials = CredentialCache.DefaultNetworkCredentials; //This isn't working, apparently
var response = (HttpWebResponse) request.GetResponse();
My first thought was to use the credentials from the incoming WebRequest
, but this is an HttpRequest
and doesn't seem to have the Credentials
property.
Does anyone know how I can pass the user's existing logged in credentials to this outgoing HttpWebRequest
?