Hi, I have the following problem: I want to protect the access to some files hosted under IIS using an asp.net page. The page will be called from another application using:
var request = WebRequest.Create("www.smth.com/protectData.aspx")
as HttpWebRequest;
request.Credentials = new NetworkCredentials("john doe", "john");
request.PreAuthenticate = true;
var response = request.GetResponse();
How to read the credentials sent on the called page (protectData.aspx)?
I have code in place in order to validate the credentials... I've tried implementing custom membership, but HttpContext.Current.User
is null.
The aspx page is hosted in a web application which hosts a WCF service authenticated with
custom policy:
system.serviceModel>
serviceAuthorization principalPermissionMode="Custom"
authorizationPolicies
add policyType="CustomPolicy.CustomPolicy, CustomPolicy" />
authorizationPolicies
system.serviceModel
For aspx pages I have no security in place for now, basically I want just to get the credentials from request and validate them using existing code.
Any help is appreciated, Adrian