Sunday, December 13, 2009

AVOID ASP.net SESSION ERROR..(null reference and others...!)

here goes our session wrapper class.....
public static class SessionHandler
{

private static string _userCountryKey = "UserCountry";

public static string UserCountry
{

get
{

/
if (HttpContext.Current.Session[SessionHandler._userCountryKey] == null)
{

return string.Empty;
}
else
{
return HttpContext.Current.Session[SessionHandler._userCountryKey].ToString();
}

}

set
{
HttpContext.Current.Session[SessionHandler._userCountryKey] = value;
}

}

}


here we can set and retrive it ....

SessionHandler.UserCountry="INDIA"

retrive using

Response.Write(SessionHandler.UserCountry);


Avoid all null references that are eating us ......

Sunday, October 4, 2009

About ME!!

Me a Software Developer.. From my inside mind i hate this field as this was against my ambition in all means.... But the stringent situation in my life path force me to stick here...

"Networking is a Dream!! CCIE"
LOL