When I start the application from Visual Studio 2010 the following error shows up:
Value cannot be null.\r\nParameter name: username
I can see this error in Global.asax.cs in the parameter sender of this method:
void Application_Error(object sender, EventArgs e)
{
}
The problem is that I’m not using username anywhere and my web.config
<configuration>
<connectionStrings>
<add name="MYSQL"
connectionString="Driver={MySQL ODBC 5.2w Driver};Server=server_name;Database=database_name;uid=my_user_id;pwd=my_pwd"
providerName="System.Data.Odbc"/>
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
</configuration>
Any help will be welcome.
EDIT:
More information:
What I can see is:
sender.base.Profile.base.base.Session = '((System.Web.HttpApplication)(sender)).Session' threw an exception of type 'System.Web.HttpException'
and
sender.Profile.base.LastActivityDate = '((System.Web.Profile.ProfileBase)(((ASP.global_asax)(sender)).Profile)).LastActivityDate' threw an exception of type 'System.ArgumentNullException'
and
sender.Profile.base.LastActivityDate.base = {"Value cannot be null.\r\nParameter name: username"}
EDIT
This code works without any problem, and also I can execute queries.
void Application_Start(object sender, EventArgs e)
{
string ConnStr = System.Configuration.ConfigurationManager.ConnectionStrings["MYSQL"].ConnectionString;
OdbcConnection con = new OdbcConnection(ConnStr);
con.Open();
con.Close();
}
For some reason this error only happens when I run the application from Visual Studio and not when it is deployed in IIS.
Thank you for your help!