By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,684 Members | 1,439 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,684 IT Pros & Developers. It's quick & easy.

Why my ASPX connect to SQL Server...

P: n/a
I am not going to write a aspx to connect a SQL Server... but it tries to connect the SQL Server...

Some of the Code..

protected void LoginButton_Click(object sender, EventArgs e)
{
if (Request.Form["txtServerName"] == null || Request.Form["txtServerName"] == "")
{
Session["Server_Name"] = "LocalHost";
}
else
{
Session["Server_Name"] = Request.Form["txtServerName"];
}
if (isValidUser((String)Session["Server_Name"], frmLogin.UserName,frmLogin.Password))
{
Session["Server_Username"] = frmLogin.UserName;
Session["Server_Password"] = frmLogin.Password;
FormsAuthentication.RedirectFromLoginPage(frmLogin .UserName, false);
Response.End();
}
else
{
//FailureText.Text = "Access Denied!";
//Response.End();
}

}

When isValid returns true, it is ok, and redirected to another page, but when isValid return false, the error occrus then, the error message is:

An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

SQLExpress database file auto-creation error:
The connection string specifies a local Sql Server Express instance using a database location within the applications App_Data directory. The provider attempted to automatically create the application services database because the provider determined that the database does not exist. The following configuration requirements are necessary to successfully check for existence of the application services database and automatically create the application services database:
1.. If the applications App_Data directory does not already exist, the web server account must have read and write access to the applications directory. This is necessary because the web server account will automatically create the App_Data directory if it does not already exist.
2.. If the applications App_Data directory already exists, the web server account only requires read and write access to the applications App_Data directory. This is necessary because the web server account will attempt to verify that the Sql Server Express database already exists within the applications App_Data directory. Revoking read access on the App_Data directory from the web server account will prevent the provider from correctly determining if the Sql Server Express database already exists. This will cause an error when the provider attempts to create a duplicate of an already existing database. Write access is required because the web server accounts credentials are used when creating the new database.
3.. Sql Server Express must be installed on the machine.
4.. The process identity for the web server account must have a local user profile. See the readme document for details on how to create a local user profile for both machine and domain accounts.
However I did not install and not running the SQL Express Edition, I want to know why the ASPX is connecting to the SQL Server but there is no code for the SQL <-ASP.NET Connections.

Thank you.
Jun 12 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
It wouldn't actually be in this code, it would be the settings in your web.config. I've noticed that as a default, when there are problems with a membership setting the membership runtime will try to connect to a sql server express database, since this is the default installation type.
--
Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006
"LamSoft" <[nospam]la*****@lamsoft.netwrote in message news:%2****************@TK2MSFTNGP02.phx.gbl...
I am not going to write a aspx to connect a SQL Server... but it tries to connect the SQL Server...

Some of the Code..

protected void LoginButton_Click(object sender, EventArgs e)
{
if (Request.Form["txtServerName"] == null || Request.Form["txtServerName"] == "")
{
Session["Server_Name"] = "LocalHost";
}
else
{
Session["Server_Name"] = Request.Form["txtServerName"];
}
if (isValidUser((String)Session["Server_Name"], frmLogin.UserName,frmLogin.Password))
{
Session["Server_Username"] = frmLogin.UserName;
Session["Server_Password"] = frmLogin.Password;
FormsAuthentication.RedirectFromLoginPage(frmLogin .UserName, false);
Response.End();
}
else
{
//FailureText.Text = "Access Denied!";
//Response.End();
}

}

When isValid returns true, it is ok, and redirected to another page, but when isValid return false, the error occrus then, the error message is:

An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

SQLExpress database file auto-creation error:
The connection string specifies a local Sql Server Express instance using a database location within the applications App_Data directory. The provider attempted to automatically create the application services database because the provider determined that the database does not exist. The following configuration requirements are necessary to successfully check for existence of the application services database and automatically create the application services database:
1.. If the applications App_Data directory does not already exist, the web server account must have read and write access to the applications directory. This is necessary because the web server account will automatically create the App_Data directory if it does not already exist.
2.. If the applications App_Data directory already exists, the web server account only requires read and write access to the applications App_Data directory. This is necessary because the web server account will attempt to verify that the Sql Server Express database already exists within the applications App_Data directory. Revoking read access on the App_Data directory from the web server account will prevent the provider from correctly determining if the Sql Server Express database already exists. This will cause an error when the provider attempts to create a duplicate of an already existing database. Write access is required because the web server accounts credentials are used when creating the new database.
3.. Sql Server Express must be installed on the machine.
4.. The process identity for the web server account must have a local user profile. See the readme document for details on how to create a local user profile for both machine and domain accounts.
However I did not install and not running the SQL Express Edition, I want to know why the ASPX is connecting to the SQL Server but there is no code for the SQL <-ASP.NET Connections.

Thank you.
Jun 12 '07 #2

P: n/a
re:
!An error has occurred while establishing a connection to the server.
!When connecting to SQL Server 2005, this failure may be caused by the fact
!that under the default settings SQL Server does not allow remote connections.

To fix that, please follow the instructions in this KB:

http://support.microsoft.com/kb/914277/en-us


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espanol : http://asp.net.do/foros/
======================================
"LamSoft" <[nospam]la*****@lamsoft.netwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
I am not going to write a aspx to connect a SQL Server... but it tries to connect the SQL Server...

Some of the Code..

protected void LoginButton_Click(object sender, EventArgs e)
{
if (Request.Form["txtServerName"] == null || Request.Form["txtServerName"] == "")
{
Session["Server_Name"] = "LocalHost";
}
else
{
Session["Server_Name"] = Request.Form["txtServerName"];
}
if (isValidUser((String)Session["Server_Name"], frmLogin.UserName,frmLogin.Password))
{
Session["Server_Username"] = frmLogin.UserName;
Session["Server_Password"] = frmLogin.Password;
FormsAuthentication.RedirectFromLoginPage(frmLogin .UserName, false);
Response.End();
}
else
{
//FailureText.Text = "Access Denied!";
//Response.End();
}

}

When isValid returns true, it is ok, and redirected to another page, but when isValid return false,
the error occrus then, the error message is:

An error has occurred while establishing a connection to the server. When connecting to SQL Server
2005, this failure may be caused by the fact that under the default settings SQL Server does not
allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating
Server/Instance Specified)
Description: An unhandled exception occurred during the execution of the current web request.
Please review the stack trace for more information about the error and where it originated in the
code.

SQLExpress database file auto-creation error:
The connection string specifies a local Sql Server Express instance using a database location within
the applications App_Data directory. The provider attempted to automatically create the application
services database because the provider determined that the database does not exist. The following
configuration requirements are necessary to successfully check for existence of the application
services database and automatically create the application services database:
1.. If the applications App_Data directory does not already exist, the web server account must
have read and write access to the applications directory. This is necessary because the web server
account will automatically create the App_Data directory if it does not already exist.
2.. If the applications App_Data directory already exists, the web server account only requires
read and write access to the applications App_Data directory. This is necessary because the web
server account will attempt to verify that the Sql Server Express database already exists within the
applications App_Data directory. Revoking read access on the App_Data directory from the web server
account will prevent the provider from correctly determining if the Sql Server Express database
already exists. This will cause an error when the provider attempts to create a duplicate of an
already existing database. Write access is required because the web server accounts credentials are
used when creating the new database.
3.. Sql Server Express must be installed on the machine.
4.. The process identity for the web server account must have a local user profile. See the readme
document for details on how to create a local user profile for both machine and domain accounts.
However I did not install and not running the SQL Express Edition, I want to know why the ASPX is
connecting to the SQL Server but there is no code for the SQL <-ASP.NET Connections.

Thank you.

Jun 12 '07 #3

P: n/a
thank you very much.
"LamSoft" <[nospam]la*****@lamsoft.netwrote in message news:%2****************@TK2MSFTNGP02.phx.gbl...
I am not going to write a aspx to connect a SQL Server... but it tries to connect the SQL Server...

Some of the Code..

protected void LoginButton_Click(object sender, EventArgs e)
{
if (Request.Form["txtServerName"] == null || Request.Form["txtServerName"] == "")
{
Session["Server_Name"] = "LocalHost";
}
else
{
Session["Server_Name"] = Request.Form["txtServerName"];
}
if (isValidUser((String)Session["Server_Name"], frmLogin.UserName,frmLogin.Password))
{
Session["Server_Username"] = frmLogin.UserName;
Session["Server_Password"] = frmLogin.Password;
FormsAuthentication.RedirectFromLoginPage(frmLogin .UserName, false);
Response.End();
}
else
{
//FailureText.Text = "Access Denied!";
//Response.End();
}

}

When isValid returns true, it is ok, and redirected to another page, but when isValid return false, the error occrus then, the error message is:

An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

SQLExpress database file auto-creation error:
The connection string specifies a local Sql Server Express instance using a database location within the applications App_Data directory. The provider attempted to automatically create the application services database because the provider determined that the database does not exist. The following configuration requirements are necessary to successfully check for existence of the application services database and automatically create the application services database:
1.. If the applications App_Data directory does not already exist, the web server account must have read and write access to the applications directory. This is necessary because the web server account will automatically create the App_Data directory if it does not already exist.
2.. If the applications App_Data directory already exists, the web server account only requires read and write access to the applications App_Data directory. This is necessary because the web server account will attempt to verify that the Sql Server Express database already exists within the applications App_Data directory. Revoking read access on the App_Data directory from the web server account will prevent the provider from correctly determining if the Sql Server Express database already exists. This will cause an error when the provider attempts to create a duplicate of an already existing database. Write access is required because the web server accounts credentials are used when creating the new database.
3.. Sql Server Express must be installed on the machine.
4.. The process identity for the web server account must have a local user profile. See the readme document for details on how to create a local user profile for both machine and domain accounts.
However I did not install and not running the SQL Express Edition, I want to know why the ASPX is connecting to the SQL Server but there is no code for the SQL <-ASP.NET Connections.

Thank you.
Jun 13 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.