I don’t know if this is a dumb question, but how can I “combine” the asp.net authentication with openlayers?
I created a Login page to authenticate in openlayers (in c#, server side), this is my code
Uri uri = new Uri("http://"+username+":"+password+"@localhost:1979/geoserver/wms");
if (uri.Scheme == Uri.UriSchemeHttp)
{
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(uri);
request.Method = WebRequestMethods.Http.Post;
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
StreamReader reader = new StreamReader(response.GetResponseStream()); string tmp = reader.ReadToEnd();
response.Close();
Response.Write(tmp);
}
I don’t know if this is the right approach to resolve my problem, anyway if I reach my goal (authenticate with username and password in geoserver), how can I combine this authentication with openlayers, which is in user side (javascript)
Thanks in advance
To authenticate with the geoserever from javascript side, you must to make a post to the geoserver autentication servlet(j_spring_security_check). Try use this login function:
And use this way