ASP.Net Server Variables

Below is the detailed table for showing the ServerVariables Collection information.

Variable Name Description
ALL_HTTP HTTP_CONNECTION:Keep-Alive HTTP_ACCEPT:*/* HTTP_ACCEPT_ENCODING:gzip, deflate HTTP_ACCEPT_LANGUAGE:sv HTTP_HOST:localhost:1229 HTTP_USER_AGENT:Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.1)
ALL_RAW Connection: Keep-Alive Accept: */* Accept-Encoding: gzip, deflate Accept-Language: sv Host: localhost:1229 User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.1)
APPL_MD_PATH  
APPL_PHYSICAL_PATH D:\code\web\demos\membership\
AUTH_TYPE NTLM
AUTH_USER SYSTEMEN-D9AE02\Stefan Holmberg
AUTH_PASSWORD  
LOGON_USER SYSTEMEN-D9AE02\Stefan Holmberg
REMOTE_USER SYSTEMEN-D9AE02\Stefan Holmberg
CERT_COOKIE  
CERT_FLAGS  
CERT_ISSUER  
CERT_KEYSIZE  
CERT_SECRETKEYSIZE  
CERT_SERIALNUMBER  
CERT_SERVER_ISSUER  
CERT_SERVER_SUBJECT  
CERT_SUBJECT  
CONTENT_LENGTH 0
CONTENT_TYPE  
GATEWAY_INTERFACE  
HTTPS  
HTTPS_KEYSIZE  
HTTPS_SECRETKEYSIZE  
HTTPS_SERVER_ISSUER  
HTTPS_SERVER_SUBJECT  
INSTANCE_ID  
INSTANCE_META_PATH  
LOCAL_ADDR 127.0.0.1
PATH_INFO /membership/servervariables.aspx
PATH_TRANSLATED D:\code\web\demos\membership\servervariables.aspx
QUERY_STRING  
REMOTE_ADDR 127.0.0.1
REMOTE_HOST 127.0.0.1
REMOTE_PORT  
REQUEST_METHOD GET
SCRIPT_NAME /membership/servervariables.aspx
SERVER_NAME localhost
SERVER_PORT 1229
SERVER_PORT_SECURE 0
SERVER_PROTOCOL HTTP/1.1
SERVER_SOFTWARE  
URL /membership/servervariables.aspx
HTTP_CONNECTION Keep-Alive
HTTP_ACCEPT */*
HTTP_ACCEPT_ENCODING gzip, deflate
HTTP_ACCEPT_LANGUAGE sv
HTTP_HOST localhost:1229
HTTP_USER_AGENT Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.1)

Storing Objects into Permanant DataStore in ASP.Net

Hi All,

I was facing a problem towards sharing a data between Flash and .Net. The easiest way i found is XML Seralization because Remoting is much heavy and it requires remoting implementation. Even now I can store the Calss objects permanantely. This can be used in concept of Hibernate (Some what at very basic level).

I found XML Seralization because there must be some common bridge between two different technoloiges for communication. XML will act as common bridge between .Net and Flash.

XML Seralization can be done by System.Xml.Serialization.XmlSerializer class from System.Xml.Serialization namespace.

Assume our class defination looks like below –

namespace EShopping
{
public class Category
{
private int _CategoryId;
public string CatName;
public int CategoryId
{
get{return _CategoryId;}
set{_CategoryId=value;}
}
}
}

Our object has below contents-

EShopping.Category c = new EShopping.Category();
c.CategoryId = 1;
c.CatName = “Hello”;

Now we want to seralize this object to the XML by XML Seralization.

System.Xml.Serialization.XmlSerializer ser = new System.Xml.Serialization.XmlSerializer(typeof(EShopping.Category));

XmlSerializer Class has a method called Seralize and Deserialize.
Seralize method requires parameter Textwriter and class object to seralize.

System.Xml.Serialization.XmlSerializer ser = new System.Xml.Serialization.XmlSerializer(typeof(EShopping.Category));

System.IO.TextWriter tw = new System.IO.StreamWriter(Server.MapPath(“SeralizeClass.xml”));

ser.Serialize(tw, c);

tw.Close();

That’s it. Now you can see the SeralizeClass.xml file in your Web root directory. You can access this into any of the technologies which has xml support.

Accessing Seralize Object into .Net-

This is pretty straight forward and just access the object by Deserialize methotd of XmlSerializer Class.

System.Xml.Serialization.XmlSerializer ser = new System.Xml.Serialization.XmlSerializer(typeof(EShopping.Category));

System.IO.TextReader tr = new System.IO.StreamReader(Server.MapPath(“SeralizeClass.xml”));

EShopping.Category c = (EShopping.Category)ser.Deserialize(tr);

tr.Close();

Happy Coding 🙂