KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have an asp.NET WCF on .NET 4. This service is used to authenticate users. We are submitting a username and password and then an HTTP Header should be returned with the authentication cookie included. Using a locally hosted test page this is working correctly. I am now attempting to access the header information cross domain. I have installed my test page on a different machine and configured to call across to the WCF. The call is working and the 'data' reply in the call is correct. However, I am unable to access the header information with either of the following: alert(xmlHttp.getAllResponseHeaders()); or alert(xmlHttp.getResponseHeader("Set-Cookie")); Using the debugger in IE and the 'Live HTTP Header' plugin for Firefox, I can see the header information is being returned. In my global ajax page I am setting the response to handle CORS. private void EnableCrossDomainAjaxCall() { HttpContext.Current.Response.AddHeader("Access-Control-Allow-Origin", "*"); if (HttpContext.Current.Request.HttpMethod == "OPTIONS") { HttpContext.Current.Response.AddHeader("Cache-Control", "no-cache"); HttpContext.Current.Response.AddHeader("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE"); HttpContext.Current.Response.AddHeader("Access-Control-Allow-Headers", "Content-Type, Accept"); HttpContext.Current.Response.AddHeader("Access-Control-Max-Age", "1728000"); HttpContext.Current.Response.End(); } } This is the AJAX I am using to call the service: $("#btnLogin").click(function(e) { var geturl; geturl = $.ajax({ // type: "POST", type: "GET", contentType: "application/json; charset=utf-8", url: 'http://10.0.4.66/AuthenticationService.svc/Login?Name=test&password=pwsd', // url: '../SecurityServer/AuthenticationService.svc/Login?Name=tes
Tags (comma-separated)
Save Edits
Cancel