Click here to Skip to main content
15,912,329 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi we have deployed our application in production and some times we face the issue of http server variables getting null values in http request object and the application crashes, we formulate xml for all server variables and send across to database for logging, the xml we get consists of all server variables and once server variables get null value it gives incomplete xml object.

The server variables we get as null values are CurrentHttpRequest.ServerVariables["HTTP_USER_AGENT"]
CurrentHttpRequest.ServerVariables["HTTP_ACCEPT"] and CurrentHttpRequest.ServerVariables["HTTP_ACCEPT_ENCODING"]


Can some one let me know which scenario the server variables gets null values , this issue is intermittent most of the time the server varible values are getting proper values and sometimes only null values coming from server variables,

It would be great if some one propose a solution for this issue as http request comes from browser.


Thanks
Srinivas Mukkanti.
Posted
Comments
Prasad Khandekar 18-Mar-13 6:49am    
Hello,

May be this is due to the fact that someone is trying to fetch page using a non-browser client. e.g. Simple JavaScript XMLHttp.
srinimuk 18-Mar-13 6:58am    
Hi Prasad, what does Simple JavaScript XMLHttp do, so you mean to say if you send a requet from IPhone will this come? do you suggest any quick fix for this issue which can be done through configuration changes on IIS Side?
Prasad Khandekar 24-Mar-13 12:44pm    
What I meant was that some one may use a simple VBScript and XMLHttp to send a request, in which case your server side code may not get the request headers. All the headers you have mentioned are typically added by the browsers automatically. You can handle this in your code, make sure you have non null values and only then call your processing.

Please use reply so that I will be notified when you add new comments.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900