Why does global.asax change sql connection?
In asp.net 3.5, I have a problem that if I upload my global.asax to a remote webserver, the application starts looking for my local sql server and eventually disconnects. I am using different config file for local and remote due to sql server login. Local is auth for Windows and remote server is auth. However, none of this data is stored in global.asax. global.asax has
but once it is loaded, something forces a remote search for local login in the sql server web.config. Removing global.asax on the remote machine makes everything work fine.
Any ideas?
source to share
Ok, in the data access DLL myapp.DataAccess.Properties has
[global::System.Configuration.DefaultSettingValueAttribute("Data Source=VISTADEV;Initial Catalog=Fin;Integrated Security=True")]
public string FinConnectionString {
get {
return ((string)(this["FinConnectionString"]));
}
}
which is my local field. I see a problem though. In global.asax.cs, instead of doing:
using (DataAccess.FinDBDataContext context = new DataAccess.FinDBDataContext (Configuration.DbConnection))
I did
using (DataAccess.FinDBDataContext context = new DataAccess.FinDBDataContext ())
which returns the default, not the config value. The problem has been solved. Thank.
source to share