Convert this PHP function to get server variables to VB .Net
I am having trouble getting server variables remotely in VB .Net I need to basically mimic this PHP Function.
function showvar($string) { if(isset($_SERVER[$string])) { echo "$string: ".rawurldecode($_SERVER[$string])."\r\n"; } } /*normal vars*/ showvar("HTTP_ACCEPT"); showvar("HTTP_ACCEPT_ENCODING"); showvar("HTTP_ACCEPT_LANGUAGE"); showvar("HTTP_ACCEPT_CHARSET"); showvar("HTTP_HOST"); showvar("HTTP_KEEP_ALIVE"); showvar("HTTP_COOKIE"); showvar("HTTP_UA_CPU"); showvar("HTTP_REFERER"); /*important vars*/ showvar("HTTP_USER_AGENT"); showvar("REMOTE_ADDR"); showvar("REMOTE_HOST"); showvar("HTTP_CONNECTION"); showvar("HTTP_X_FORWARDED_FOR"); showvar("HTTP_FORWARDED"); showvar("HTTP_VIA"); showvar("KEEP_ALIVE"); showvar("HTTP_MAX_FORWARDS"); showvar("MAX_FORWARDS"); showvar("HTTP_CACHE_CONTROL"); showvar("HTTP_PROXY_CONNECTION"); showvar("HTTP_X_BLUECOAT_VIA"); showvar("HTTP_PC_REMOTE_ADDR"); showvar("HTTP_PROXY___________"); showvar("HTTP_PROXY____"); showvar("HTTP_X_FWD_IP_ADDR"); showvar("HTTP_X_HOST"); showvar("HTTP_X_REFERER"); showvar("HTTP_X_S开发者_运维知识库ERVER_HOSTNAME"); showvar("PROXY_HOST"); showvar("PROXY_PORT"); showvar("PROXY_REQUEST"); showvar("HTTP_CLIENT_IP"); showvar("HTTP_PRAGMA");
Can anybody get me pointed in the right direction? Atleast show me how to return one variable. Thanks I have searched everywhere
Just use Request.ServerVariables(VariableName)
Example Request.ServerVariables("LOGON_USER")
精彩评论