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?

+1


source to share


4 answers


Removing the global.asax file that will result in the inherited class being used, is there any code in the inherited class that might cause the changes?



..axax can be empty, but that does not mean that it is an inherited class.

+1


source


Have you checked the class inheriting? It appears to be inheriting from myapp.Global



0


source


Make sure the myapp.Global class refers to the membership, role, or profile providers; by default, each of them uses a local SQL server connection.

0


source


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.

0


source







All Articles