request.servervariables collection

T

TS

I seem to remember reading somewhere that accessing this collection is
expensive and you should avoid it if possible. Are there any alternatives to
the following:
Request.ServerVariables["SCRIPT_NAME"];

Request.ServerVariables["HTTP_HOST"];

Request.ServerVariables["HTTP_USER_AGENT"];

Request.ServerVariables["AUTH_USER"];

Request.ServerVariables["LOGON_USER"];

Request.ServerVariables["SERVER_NAME"];

Request.ServerVariables["LOCAL_ADDR"];

Request.ServerVariables["REMOTE_ADDR"];
 
S

Steven Cheng[MSFT]

Hi TS,

As for those ServerVariables you mentioned, in ASP.NET the Buildin objects
such as
Request or the HttpContext.Current's members have encapsulated some of
those servervariables. For example:

Request.Browser
Request.Path
Request.RawUrl
Request.UserAgent
Request.UserHostAddress
Request.UserHostName
Request.UserLanguages
the HttpContext.Current which contains some member indicate the security
context
HttpContext.Current.User

Also, still many other variables which need to retrieve from the
ServerVariables collection.


Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
S

Steven Cheng[MSFT]

Hi TS,

Have you had a chance to check out the suggestions in my last reply or have
you got any further ideas on this issue? If you have anything unclear or if
there're anything else we can help, please feel free to post here. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top