Accessing Request headers from asp.net web service, invoked using Ajax

                I need a small help.

I have a web service, in which I have a web method, which detects the browser locale using asp.net request object.

If I invoke the web service directly from the browser, I am able to get the browser language from Request object’s HTTP_ACCEPT_LANGUAGE header.

But If I invoke the same web method from some aspx using javascript XMLHttpRequest, I always get the request header HTTP_ACCEPT_LANGUAGE null.

Is this the behavior of the web services.

Then how can I access the browser language setting for the current request in the web service.

Is there a way to invoke the web service with the same request settings as that of aspx page while using xmlhttp.

Thanks in Advance

10/30/2007 10:29:09 AM
asp.net.networking-webservices 2181 articles. 0 followers. Follow

1 Replies

Similar Articles

[PageSpeed] 8
Get it on Google Play
Get it on Apple App Store


I saw that you got this issue answered by John Saunders at http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2341086&SiteID=1, Here is quotation:

  • You are unlikely to receive a browser language setting if the web service is not called from a browser.
  • The workaround would be to send the language directly in a parameter to the web service operations that require it, or by using a SOAP Header.

Best Regards,

Jin-Yu Yin
Microsoft Online Community Support
11/5/2007 8:12:26 AM