Lee, I never liked the way .NET implemented page methods, so usually for doing Ajax calls in .NET I used this library http://www.ajaxpro.info/ The way you defined methods and called them seemed much more intuitive to me than the way .NET built in PageMethod call thing works and it seemed to work fine with both Forms Authentication and without. Just my two cents. Thanks, Regina
________________________________ From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Lee Keel Sent: Friday, May 30, 2008 11:24 AM To: [email protected] Subject: Re: [OpenLayers-Users] Authentication Error I did not get many replies to this, so I thought I would elaborate a little more and explain why I asked this question on this forum. I have a map that I have on a page that is on a secure website using forms authentication. When the user clicks on the map, I want to send the coordinates, visible layers, and resolution back to the server so that I can perform a database query. I was doing this by using an AJAX call to a WebMethod on my page which would set these values in session variables, then I would call refresh on an updatepanel and then perform some work with the session variables. Before I implemented security, this was working just fine, but now that I have security turned on for this page I get an Authentication Error whenever I try to make my PageMethod call. So here is some code that was working before security was enabled: javascript: click: function (evt) { OpenLayers.Console.dir(evt); var layers = []; for (var i = 0; i < map.layers.length; i++){ if (map.layers[i].visibility == true && map.layers[i].inRange == true ){ layers.push(map.layers[i].name); } } var lonlat = map.getLonLatFromPixel(evt.xy); var resolution = map.getResolution(); PageMethods.SearchPoint(lonlat.lon, lonlat.lat, resolution, layers, SearchPointSuccess, SearchPointFailure); Event.stop(evt); }, function SearchPointSuccess(args) { __doPostBack('<%= udpTabs.ClientID %>', ''); } C#: [WebMethod(EnableSession = true)] public static void SearchPoint(double X, double Y, double resolution, string[] layers){ HttpContext.Current.Session["X"] = X; HttpContext.Current.Session["Y"] = Y; HttpContext.Current.Session["resolution"] = resolution; HttpContext.Current.Session["layers"] = layers; HttpContext.Current.Session["searchtype"] = "IdentifyPoint"; HttpContext.Current.Session["srid"] = ConfigurationManager.AppSettings["srid"]; } protected void Page_Load(object sender, EventArgs e){ if(this.IsPostBack) { //Get session variables and do work } } Does anyone have a better way to send information from the client back to the server? Or at this point I would even settle for a way that works with security on. My only thought right now is to put these values into a hidden field and when the refresh is performed I could parse the information from the text. But it just seemed to me that the AJAX call was much cleaner and more secure. Thanks in advance, Lee ________________________________ From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Lee Keel Sent: Wednesday, May 28, 2008 11:22 AM To: [email protected] Subject: [OpenLayers-Users] Authentication Error Hello All, I have been trying to implement forms authentication on my website and have run into a little snag. I know this is not directly an OpenLayers question, but there are so many smart javascript programmers on here, I am hoping for an answer. The problem is that now that I have security enabled I am having a problem making calls from my javascript back to my webmethods using the PageMethod calls. When ever I make a PageMethod call, I get a 401 - "Authentication Failed". Has anyone experienced this before? If so, could you please give me some idea on how you fixed it? Best Regards, Lee Keel ----------------------------------------- The substance of this message, including any attachments, may be confidential, legally privileged and/or exempt from disclosure pursuant to Massachusetts law. It is intended solely for the addressee. If you received this in error, please contact the sender and delete the material from any computer.
<<Blank Bkgrd.gif>>
_______________________________________________ Users mailing list [email protected] http://openlayers.org/mailman/listinfo/users
