Hi
I have the same problem and casting it to string is not helping either. I am trying to debug the application and i have defines Session variable in Global.asax file but the control doesnt go there.
Here is my Global.asax code
void httpmodule_SessionHandler(Object sender, EventArgs e)
{
/// <summary>
///Instance of cGlobal class witch will manage every request to web server
/// </summary>
Conversion _session = new Conversion();
}
void Application_Start(object sender, EventArgs e)
{
// Code that runs on application startup
//Conversion _session = new Conversion();
}
void Session_Start(object sender, EventArgs e)
{
// Code that runs when a new session is started
Conversion _session = new Conversion();
Session["Started"] = true;
}
Conversion is another class file where i am trying to get the value of session variable and getting NullRefernceException Error.
Here is code for that class:
public class Conversion
{
string strServerName;
string logonid;
Database db = null;
HttpContext _http = HttpContext.Current;
string _connString = ConfigurationSettings.AppSettings["connString"];
public Conversion()
{
//get the environment and data connection string
strServerName = HttpContext.Current.Request.ServerVariables["SERVER_NAME"];
strServerName = strServerName.ToString().Trim().ToUpper();
if ((String)HttpContext.Current.Session["Started"]==null )
{
switch (strServerName)
{
}
Any help will be appreciated.
Thanks
Kamal
|