I need to pass the value entered in a textbox control by the admin on application start to the global.asax file , where I can then make it into a Application object. I want this application object to persist for all users and thier sessions but only for a particular database connection string. Is Application object the right choice for this purpose , and if yes how to incorporate it ?
This is what i have tried :
global.asax:
public class Global : System.Web.HttpApplication
{
SqlConnection con=new SqlConnection(ConfigurationManager.ConnectionStrings["Con"].ConnectionString);
protected void Application_Start(object sender, EventArgs e)
{
string folderName = SetPaths.Tbrootpath.Text.ToString();
string pathString = System.IO.Path.Combine(folderName, "ScannedData");
Application["scannedDataPath"] = pathString;
}
and i call it where required as :
string pathstring = HttpContext.Current.Application["ScannedDataPath"].ToString();
I get SetPaths.Tbrootpath is inaccessible ..