473,396 Members | 1,760 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Why my ASPX connect to SQL Server...

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
3 2721
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Wardeaux | last post by:
Hey all, I'm hitting a wall... We have many daily reports generated on another server, need to present list of available files and allow user to download desired files from aspx page... any...
1
by: adam | last post by:
On Thursday it was working, then something changed and now I can't access my sql server database from aspx :( I have simplified my code to a simple connect and query where m_sql, m_con are text...
4
by: Nathaniel Sherman | last post by:
Alright, folks, here's the deal... I'm working on migrating a classic ASP website to an ASP.NET codebase. At the heart of the site is a MySQL database. To make sure an "in-process" program...
1
by: Jim Bayers | last post by:
Our network nazi doesn't want us running a webserver on the server that has a connection to the campus database so we created a remote object that runs as a windows service. The windows service...
3
by: Mike Dee | last post by:
I posted this back in November 2005 a couple times but did not get any responses. I'm hoping someone here can please shed some light on this. I'm new to index server and can't get any DocTitle...
1
by: RashmiKulki | last post by:
hi all, please let me know how access a .aspx file from a remote system,when the client system does not have .NET framework & at the server side the website is running on the ASP.NET web...
0
by: thomasburrows1 | last post by:
Please excuse my simple question. I have the following C#.NET code. using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using...
3
by: =?Utf-8?B?QnJhbmRvbg==?= | last post by:
Hi, I have an aspx page that has the "include" code in it which includes another page that displays information. I also have an upload page that allows users to upload a simple html document...
1
by: ismailc | last post by:
Good day, Need to connect & retrieve from SQL DB in aspx page. I don't know aspx & only want to edit the page to sow additional information. Can you please help by providing some code? ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.