473,569 Members | 2,721 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Connecting to SQL Server on WIN2003 Box

I am trying to connect to a 2003 Server from an ASP.Net page and am getting
the following error message. Can someone please help get me started on how to
track and fix this error? The code I am using is below the error I am
getting.

Error: System.Data.Sql Client.SqlExcep tion: SQL Server does not exist or
access denied. at System.Data.Sql Client.Connecti onPool.GetConne ction(Boolean&
isInTransaction ) at
System.Data.Sql Client.SqlConne ctionPoolManage r.GetPooledConn ection(SqlConne ctionString
options, Boolean& isInTransaction ) at
System.Data.Sql Client.SqlConne ction.Open() at
testbed.Navigat ion.Page_Load(O bject sender, EventArgs e) in c:\documents and
settings\collin ss\vswebcache\6 05webdev-2_443\testbed\n avigation.aspx. cs:line
31

private void Page_Load(objec t sender, System.EventArg s e)
{
// Put user code to initialize the page here
SqlDataReader dataReader = null;

try
{
SqlConnection connection = new
SqlConnection(" Server=TestWebS erver;Database= Common;user id=myUserID;
password=myPass word");
SqlCommand command = new SqlCommand("Get NavigationMenu" , connection);
command.Command Type = CommandType.Sto redProcedure;
connection.Open ();
dataReader = command.Execute Reader();

while (dataReader.Rea d())
{
string headerMenu = (string)dataRea der["HeaderMenu "];
string sectionID = (string)dataRea der["SectionID"];
string navigationMenuI D = (string)dataRea der["NavigationMenu ID"];
string menuName = (string)dataRea der["MenuName"];
string pageUrl = (string)dataRea der["PageUrl"];
string ImageUrl = (string)dataRea der["ImageUrl"];
}

dataReader.Clos e();
connection.Clos e();
}

catch (System.Excepti on exception)
{
Response.Write( "Error: " + exception.ToStr ing());
return;
}

finally
{
if (dataReader != null)
{
dataReader.Clos e();
}
}
}
Dec 20 '05 #1
10 1417
Verify that you can connect using the specified username and password in SQL
Query Analyzer.

I assume the server is setup with both SQL and Integrated login enabled and
that you have created the specified login in the SQL server and granted the
login access to the given database?

Also, to make sure you can connect, try from a command prompt on the
webserver to telnet to port 1433 (if TCP/IP is the transport you're using).
Regards,

Arild

"Mike Collins" <Mi*********@di scussions.micro soft.com> wrote in message
news:9C******** *************** ***********@mic rosoft.com...
I am trying to connect to a 2003 Server from an ASP.Net page and am getting
the following error message. Can someone please help get me started on how
to
track and fix this error? The code I am using is below the error I am
getting.

Error: System.Data.Sql Client.SqlExcep tion: SQL Server does not exist or
access denied. at
System.Data.Sql Client.Connecti onPool.GetConne ction(Boolean&
isInTransaction ) at
System.Data.Sql Client.SqlConne ctionPoolManage r.GetPooledConn ection(SqlConne ctionString
options, Boolean& isInTransaction ) at
System.Data.Sql Client.SqlConne ction.Open() at
testbed.Navigat ion.Page_Load(O bject sender, EventArgs e) in c:\documents
and
settings\collin ss\vswebcache\6 05webdev-2_443\testbed\n avigation.aspx. cs:line
31

private void Page_Load(objec t sender, System.EventArg s e)
{
// Put user code to initialize the page here
SqlDataReader dataReader = null;

try
{
SqlConnection connection = new
SqlConnection(" Server=TestWebS erver;Database= Common;user id=myUserID;
password=myPass word");
SqlCommand command = new SqlCommand("Get NavigationMenu" , connection);
command.Command Type = CommandType.Sto redProcedure;
connection.Open ();
dataReader = command.Execute Reader();

while (dataReader.Rea d())
{
string headerMenu = (string)dataRea der["HeaderMenu "];
string sectionID = (string)dataRea der["SectionID"];
string navigationMenuI D = (string)dataRea der["NavigationMenu ID"];
string menuName = (string)dataRea der["MenuName"];
string pageUrl = (string)dataRea der["PageUrl"];
string ImageUrl = (string)dataRea der["ImageUrl"];
}

dataReader.Clos e();
connection.Clos e();
}

catch (System.Excepti on exception)
{
Response.Write( "Error: " + exception.ToStr ing());
return;
}

finally
{
if (dataReader != null)
{
dataReader.Clos e();
}
}
}

Dec 20 '05 #2
The server is set for both SQL and integrated login. I'm not sure how to use
a command prompt to telnet to port 1433. If you can help with that, I'll give
it a try.

Here is other information that I forgot earlier.
1. I am trying to connect from a Windows XP Professional computer.
2. Currently the server is both a web and database server using Win 2003.
3. We are trying to develop on our XP boxes and test items before moving the
pages over to the test server.

Thanks

"Arild Bakken" wrote:
Verify that you can connect using the specified username and password in SQL
Query Analyzer.

I assume the server is setup with both SQL and Integrated login enabled and
that you have created the specified login in the SQL server and granted the
login access to the given database?

Also, to make sure you can connect, try from a command prompt on the
webserver to telnet to port 1433 (if TCP/IP is the transport you're using).
Regards,

Arild

"Mike Collins" <Mi*********@di scussions.micro soft.com> wrote in message
news:9C******** *************** ***********@mic rosoft.com...
I am trying to connect to a 2003 Server from an ASP.Net page and am getting
the following error message. Can someone please help get me started on how
to
track and fix this error? The code I am using is below the error I am
getting.

Error: System.Data.Sql Client.SqlExcep tion: SQL Server does not exist or
access denied. at
System.Data.Sql Client.Connecti onPool.GetConne ction(Boolean&
isInTransaction ) at
System.Data.Sql Client.SqlConne ctionPoolManage r.GetPooledConn ection(SqlConne ctionString
options, Boolean& isInTransaction ) at
System.Data.Sql Client.SqlConne ction.Open() at
testbed.Navigat ion.Page_Load(O bject sender, EventArgs e) in c:\documents
and
settings\collin ss\vswebcache\6 05webdev-2_443\testbed\n avigation.aspx. cs:line
31

private void Page_Load(objec t sender, System.EventArg s e)
{
// Put user code to initialize the page here
SqlDataReader dataReader = null;

try
{
SqlConnection connection = new
SqlConnection(" Server=TestWebS erver;Database= Common;user id=myUserID;
password=myPass word");
SqlCommand command = new SqlCommand("Get NavigationMenu" , connection);
command.Command Type = CommandType.Sto redProcedure;
connection.Open ();
dataReader = command.Execute Reader();

while (dataReader.Rea d())
{
string headerMenu = (string)dataRea der["HeaderMenu "];
string sectionID = (string)dataRea der["SectionID"];
string navigationMenuI D = (string)dataRea der["NavigationMenu ID"];
string menuName = (string)dataRea der["MenuName"];
string pageUrl = (string)dataRea der["PageUrl"];
string ImageUrl = (string)dataRea der["ImageUrl"];
}

dataReader.Clos e();
connection.Clos e();
}

catch (System.Excepti on exception)
{
Response.Write( "Error: " + exception.ToStr ing());
return;
}

finally
{
if (dataReader != null)
{
dataReader.Clos e();
}
}
}


Dec 20 '05 #3
Mike,

The issue arises from the fact that you are running with default
credentials in ASP.NET. By default, all code that runs in ASP.NET runs
under the ASPNET local user. This doesn't have access to network resources.

In order to get around this, you have to impersonate a user (through
code, or through a declaration in web.config) which has rights to the
network, and to SQL Server.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Mike Collins" <Mi*********@di scussions.micro soft.com> wrote in message
news:D0******** *************** ***********@mic rosoft.com...
The server is set for both SQL and integrated login. I'm not sure how to
use
a command prompt to telnet to port 1433. If you can help with that, I'll
give
it a try.

Here is other information that I forgot earlier.
1. I am trying to connect from a Windows XP Professional computer.
2. Currently the server is both a web and database server using Win 2003.
3. We are trying to develop on our XP boxes and test items before moving
the
pages over to the test server.

Thanks

"Arild Bakken" wrote:
Verify that you can connect using the specified username and password in
SQL
Query Analyzer.

I assume the server is setup with both SQL and Integrated login enabled
and
that you have created the specified login in the SQL server and granted
the
login access to the given database?

Also, to make sure you can connect, try from a command prompt on the
webserver to telnet to port 1433 (if TCP/IP is the transport you're
using).
Regards,

Arild

"Mike Collins" <Mi*********@di scussions.micro soft.com> wrote in message
news:9C******** *************** ***********@mic rosoft.com...
>I am trying to connect to a 2003 Server from an ASP.Net page and am
>getting
> the following error message. Can someone please help get me started on
> how
> to
> track and fix this error? The code I am using is below the error I am
> getting.
>
> Error: System.Data.Sql Client.SqlExcep tion: SQL Server does not exist or
> access denied. at
> System.Data.Sql Client.Connecti onPool.GetConne ction(Boolean&
> isInTransaction ) at
> System.Data.Sql Client.SqlConne ctionPoolManage r.GetPooledConn ection(SqlConne ctionString
> options, Boolean& isInTransaction ) at
> System.Data.Sql Client.SqlConne ction.Open() at
> testbed.Navigat ion.Page_Load(O bject sender, EventArgs e) in
> c:\documents
> and
> settings\collin ss\vswebcache\6 05webdev-2_443\testbed\n avigation.aspx. cs:line
> 31
>
> private void Page_Load(objec t sender, System.EventArg s e)
> {
> // Put user code to initialize the page here
> SqlDataReader dataReader = null;
>
> try
> {
> SqlConnection connection = new
> SqlConnection(" Server=TestWebS erver;Database= Common;user id=myUserID;
> password=myPass word");
> SqlCommand command = new SqlCommand("Get NavigationMenu" , connection);
> command.Command Type = CommandType.Sto redProcedure;
> connection.Open ();
> dataReader = command.Execute Reader();
>
> while (dataReader.Rea d())
> {
> string headerMenu = (string)dataRea der["HeaderMenu "];
> string sectionID = (string)dataRea der["SectionID"];
> string navigationMenuI D = (string)dataRea der["NavigationMenu ID"];
> string menuName = (string)dataRea der["MenuName"];
> string pageUrl = (string)dataRea der["PageUrl"];
> string ImageUrl = (string)dataRea der["ImageUrl"];
> }
>
> dataReader.Clos e();
> connection.Clos e();
> }
>
> catch (System.Excepti on exception)
> {
> Response.Write( "Error: " + exception.ToStr ing());
> return;
> }
>
> finally
> {
> if (dataReader != null)
> {
> dataReader.Clos e();
> }
> }
> }


Dec 20 '05 #4
To try connecting to the server using telnet:

1. Start a command prompt (Start / Run / type "cmd" and press enter).
2. Type: telnet TestWebServer 1433

This only works if the server is configured to use TCP/IP and only if the
SQL server instance is using port 1433 - you can check that on the server
using the SQL server configuration tool.

Another thing, is the SQL instance the default instance or is it a named
instance? If it is a named instance you need to include the instance name in
the server name, like servername\inst ancename.
Arild

"Mike Collins" <Mi*********@di scussions.micro soft.com> wrote in message
news:D0******** *************** ***********@mic rosoft.com...
The server is set for both SQL and integrated login. I'm not sure how to
use
a command prompt to telnet to port 1433. If you can help with that, I'll
give
it a try.

Here is other information that I forgot earlier.
1. I am trying to connect from a Windows XP Professional computer.
2. Currently the server is both a web and database server using Win 2003.
3. We are trying to develop on our XP boxes and test items before moving
the
pages over to the test server.

Thanks

"Arild Bakken" wrote:
Verify that you can connect using the specified username and password in
SQL
Query Analyzer.

I assume the server is setup with both SQL and Integrated login enabled
and
that you have created the specified login in the SQL server and granted
the
login access to the given database?

Also, to make sure you can connect, try from a command prompt on the
webserver to telnet to port 1433 (if TCP/IP is the transport you're
using).
Regards,

Arild

"Mike Collins" <Mi*********@di scussions.micro soft.com> wrote in message
news:9C******** *************** ***********@mic rosoft.com...
>I am trying to connect to a 2003 Server from an ASP.Net page and am
>getting
> the following error message. Can someone please help get me started on
> how
> to
> track and fix this error? The code I am using is below the error I am
> getting.
>
> Error: System.Data.Sql Client.SqlExcep tion: SQL Server does not exist or
> access denied. at
> System.Data.Sql Client.Connecti onPool.GetConne ction(Boolean&
> isInTransaction ) at
> System.Data.Sql Client.SqlConne ctionPoolManage r.GetPooledConn ection(SqlConne ctionString
> options, Boolean& isInTransaction ) at
> System.Data.Sql Client.SqlConne ction.Open() at
> testbed.Navigat ion.Page_Load(O bject sender, EventArgs e) in
> c:\documents
> and
> settings\collin ss\vswebcache\6 05webdev-2_443\testbed\n avigation.aspx. cs:line
> 31
>
> private void Page_Load(objec t sender, System.EventArg s e)
> {
> // Put user code to initialize the page here
> SqlDataReader dataReader = null;
>
> try
> {
> SqlConnection connection = new
> SqlConnection(" Server=TestWebS erver;Database= Common;user id=myUserID;
> password=myPass word");
> SqlCommand command = new SqlCommand("Get NavigationMenu" , connection);
> command.Command Type = CommandType.Sto redProcedure;
> connection.Open ();
> dataReader = command.Execute Reader();
>
> while (dataReader.Rea d())
> {
> string headerMenu = (string)dataRea der["HeaderMenu "];
> string sectionID = (string)dataRea der["SectionID"];
> string navigationMenuI D = (string)dataRea der["NavigationMenu ID"];
> string menuName = (string)dataRea der["MenuName"];
> string pageUrl = (string)dataRea der["PageUrl"];
> string ImageUrl = (string)dataRea der["ImageUrl"];
> }
>
> dataReader.Clos e();
> connection.Clos e();
> }
>
> catch (System.Excepti on exception)
> {
> Response.Write( "Error: " + exception.ToStr ing());
> return;
> }
>
> finally
> {
> if (dataReader != null)
> {
> dataReader.Clos e();
> }
> }
> }


Dec 20 '05 #5
On W2K3 aspnet runs as NETWORK_SERVICE , not as aspnet.

Willy.

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote in
message news:uK******** ******@TK2MSFTN GP10.phx.gbl...
Mike,

The issue arises from the fact that you are running with default
credentials in ASP.NET. By default, all code that runs in ASP.NET runs
under the ASPNET local user. This doesn't have access to network
resources.

In order to get around this, you have to impersonate a user (through
code, or through a declaration in web.config) which has rights to the
network, and to SQL Server.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Mike Collins" <Mi*********@di scussions.micro soft.com> wrote in message
news:D0******** *************** ***********@mic rosoft.com...
The server is set for both SQL and integrated login. I'm not sure how to
use
a command prompt to telnet to port 1433. If you can help with that, I'll
give
it a try.

Here is other information that I forgot earlier.
1. I am trying to connect from a Windows XP Professional computer.
2. Currently the server is both a web and database server using Win 2003.
3. We are trying to develop on our XP boxes and test items before moving
the
pages over to the test server.

Thanks

"Arild Bakken" wrote:
Verify that you can connect using the specified username and password in
SQL
Query Analyzer.

I assume the server is setup with both SQL and Integrated login enabled
and
that you have created the specified login in the SQL server and granted
the
login access to the given database?

Also, to make sure you can connect, try from a command prompt on the
webserver to telnet to port 1433 (if TCP/IP is the transport you're
using).
Regards,

Arild

"Mike Collins" <Mi*********@di scussions.micro soft.com> wrote in message
news:9C******** *************** ***********@mic rosoft.com...
>I am trying to connect to a 2003 Server from an ASP.Net page and am
>getting
> the following error message. Can someone please help get me started on
> how
> to
> track and fix this error? The code I am using is below the error I am
> getting.
>
> Error: System.Data.Sql Client.SqlExcep tion: SQL Server does not exist
> or
> access denied. at
> System.Data.Sql Client.Connecti onPool.GetConne ction(Boolean&
> isInTransaction ) at
> System.Data.Sql Client.SqlConne ctionPoolManage r.GetPooledConn ection(SqlConne ctionString
> options, Boolean& isInTransaction ) at
> System.Data.Sql Client.SqlConne ction.Open() at
> testbed.Navigat ion.Page_Load(O bject sender, EventArgs e) in
> c:\documents
> and
> settings\collin ss\vswebcache\6 05webdev-2_443\testbed\n avigation.aspx. cs:line
> 31
>
> private void Page_Load(objec t sender, System.EventArg s e)
> {
> // Put user code to initialize the page here
> SqlDataReader dataReader = null;
>
> try
> {
> SqlConnection connection = new
> SqlConnection(" Server=TestWebS erver;Database= Common;user id=myUserID;
> password=myPass word");
> SqlCommand command = new SqlCommand("Get NavigationMenu" , connection);
> command.Command Type = CommandType.Sto redProcedure;
> connection.Open ();
> dataReader = command.Execute Reader();
>
> while (dataReader.Rea d())
> {
> string headerMenu = (string)dataRea der["HeaderMenu "];
> string sectionID = (string)dataRea der["SectionID"];
> string navigationMenuI D = (string)dataRea der["NavigationMenu ID"];
> string menuName = (string)dataRea der["MenuName"];
> string pageUrl = (string)dataRea der["PageUrl"];
> string ImageUrl = (string)dataRea der["ImageUrl"];
> }
>
> dataReader.Clos e();
> connection.Clos e();
> }
>
> catch (System.Excepti on exception)
> {
> Response.Write( "Error: " + exception.ToStr ing());
> return;
> }
>
> finally
> {
> if (dataReader != null)
> {
> dataReader.Clos e();
> }
> }
> }


Dec 20 '05 #6
Set your connection string to use integrated security, and add NETWORK
SERVICE as a user and grant appropriate rights.
NT AUTHORITY\NETWO RK USER is the the default user running aspnet.
Note that I noticed that you are running IIS and SQL on the same box (W2K3),
above is only applicable in such configuration.

Willy.

"Mike Collins" <Mi*********@di scussions.micro soft.com> wrote in message
news:9C******** *************** ***********@mic rosoft.com...
I am trying to connect to a 2003 Server from an ASP.Net page and am getting
the following error message. Can someone please help get me started on how
to
track and fix this error? The code I am using is below the error I am
getting.

Error: System.Data.Sql Client.SqlExcep tion: SQL Server does not exist or
access denied. at
System.Data.Sql Client.Connecti onPool.GetConne ction(Boolean&
isInTransaction ) at
System.Data.Sql Client.SqlConne ctionPoolManage r.GetPooledConn ection(SqlConne ctionString
options, Boolean& isInTransaction ) at
System.Data.Sql Client.SqlConne ction.Open() at
testbed.Navigat ion.Page_Load(O bject sender, EventArgs e) in c:\documents
and
settings\collin ss\vswebcache\6 05webdev-2_443\testbed\n avigation.aspx. cs:line
31

private void Page_Load(objec t sender, System.EventArg s e)
{
// Put user code to initialize the page here
SqlDataReader dataReader = null;

try
{
SqlConnection connection = new
SqlConnection(" Server=TestWebS erver;Database= Common;user id=myUserID;
password=myPass word");
SqlCommand command = new SqlCommand("Get NavigationMenu" , connection);
command.Command Type = CommandType.Sto redProcedure;
connection.Open ();
dataReader = command.Execute Reader();

while (dataReader.Rea d())
{
string headerMenu = (string)dataRea der["HeaderMenu "];
string sectionID = (string)dataRea der["SectionID"];
string navigationMenuI D = (string)dataRea der["NavigationMenu ID"];
string menuName = (string)dataRea der["MenuName"];
string pageUrl = (string)dataRea der["PageUrl"];
string ImageUrl = (string)dataRea der["ImageUrl"];
}

dataReader.Clos e();
connection.Clos e();
}

catch (System.Excepti on exception)
{
Response.Write( "Error: " + exception.ToStr ing());
return;
}

finally
{
if (dataReader != null)
{
dataReader.Clos e();
}
}
}

Dec 20 '05 #7
Thanks to all of you for your input. I'm going to look into adding rights in
webconfig. I'll make another post, in a couple of days, if I need further
assistance. Thanks again.

"Arild Bakken" wrote:
To try connecting to the server using telnet:

1. Start a command prompt (Start / Run / type "cmd" and press enter).
2. Type: telnet TestWebServer 1433

This only works if the server is configured to use TCP/IP and only if the
SQL server instance is using port 1433 - you can check that on the server
using the SQL server configuration tool.

Another thing, is the SQL instance the default instance or is it a named
instance? If it is a named instance you need to include the instance name in
the server name, like servername\inst ancename.
Arild

"Mike Collins" <Mi*********@di scussions.micro soft.com> wrote in message
news:D0******** *************** ***********@mic rosoft.com...
The server is set for both SQL and integrated login. I'm not sure how to
use
a command prompt to telnet to port 1433. If you can help with that, I'll
give
it a try.

Here is other information that I forgot earlier.
1. I am trying to connect from a Windows XP Professional computer.
2. Currently the server is both a web and database server using Win 2003.
3. We are trying to develop on our XP boxes and test items before moving
the
pages over to the test server.

Thanks

"Arild Bakken" wrote:
Verify that you can connect using the specified username and password in
SQL
Query Analyzer.

I assume the server is setup with both SQL and Integrated login enabled
and
that you have created the specified login in the SQL server and granted
the
login access to the given database?

Also, to make sure you can connect, try from a command prompt on the
webserver to telnet to port 1433 (if TCP/IP is the transport you're
using).
Regards,

Arild

"Mike Collins" <Mi*********@di scussions.micro soft.com> wrote in message
news:9C******** *************** ***********@mic rosoft.com...
>I am trying to connect to a 2003 Server from an ASP.Net page and am
>getting
> the following error message. Can someone please help get me started on
> how
> to
> track and fix this error? The code I am using is below the error I am
> getting.
>
> Error: System.Data.Sql Client.SqlExcep tion: SQL Server does not exist or
> access denied. at
> System.Data.Sql Client.Connecti onPool.GetConne ction(Boolean&
> isInTransaction ) at
> System.Data.Sql Client.SqlConne ctionPoolManage r.GetPooledConn ection(SqlConne ctionString
> options, Boolean& isInTransaction ) at
> System.Data.Sql Client.SqlConne ction.Open() at
> testbed.Navigat ion.Page_Load(O bject sender, EventArgs e) in
> c:\documents
> and
> settings\collin ss\vswebcache\6 05webdev-2_443\testbed\n avigation.aspx. cs:line
> 31
>
> private void Page_Load(objec t sender, System.EventArg s e)
> {
> // Put user code to initialize the page here
> SqlDataReader dataReader = null;
>
> try
> {
> SqlConnection connection = new
> SqlConnection(" Server=TestWebS erver;Database= Common;user id=myUserID;
> password=myPass word");
> SqlCommand command = new SqlCommand("Get NavigationMenu" , connection);
> command.Command Type = CommandType.Sto redProcedure;
> connection.Open ();
> dataReader = command.Execute Reader();
>
> while (dataReader.Rea d())
> {
> string headerMenu = (string)dataRea der["HeaderMenu "];
> string sectionID = (string)dataRea der["SectionID"];
> string navigationMenuI D = (string)dataRea der["NavigationMenu ID"];
> string menuName = (string)dataRea der["MenuName"];
> string pageUrl = (string)dataRea der["PageUrl"];
> string ImageUrl = (string)dataRea der["ImageUrl"];
> }
>
> dataReader.Clos e();
> connection.Clos e();
> }
>
> catch (System.Excepti on exception)
> {
> Response.Write( "Error: " + exception.ToStr ing());
> return;
> }
>
> finally
> {
> if (dataReader != null)
> {
> dataReader.Clos e();
> }
> }
> }


Dec 20 '05 #8
I'm confused. If the connection string is specifying "User
Id=sa;Password= sa_password", then why in all of creation is ASP.NET sending
credentials as ASPNET and not "sa"? What's the point in having SQL
credentials if you can't use them?

"Willy Denoyette [MVP]" wrote:
Set your connection string to use integrated security, and add NETWORK
SERVICE as a user and grant appropriate rights.
NT AUTHORITY\NETWO RK USER is the the default user running aspnet.
Note that I noticed that you are running IIS and SQL on the same box (W2K3),
above is only applicable in such configuration.

Willy.

"Mike Collins" <Mi*********@di scussions.micro soft.com> wrote in message
news:9C******** *************** ***********@mic rosoft.com...
I am trying to connect to a 2003 Server from an ASP.Net page and am getting
the following error message. Can someone please help get me started on how
to
track and fix this error? The code I am using is below the error I am
getting.

Error: System.Data.Sql Client.SqlExcep tion: SQL Server does not exist or
access denied. at
System.Data.Sql Client.Connecti onPool.GetConne ction(Boolean&
isInTransaction ) at
System.Data.Sql Client.SqlConne ctionPoolManage r.GetPooledConn ection(SqlConne ctionString
options, Boolean& isInTransaction ) at
System.Data.Sql Client.SqlConne ction.Open() at
testbed.Navigat ion.Page_Load(O bject sender, EventArgs e) in c:\documents
and
settings\collin ss\vswebcache\6 05webdev-2_443\testbed\n avigation.aspx. cs:line
31

private void Page_Load(objec t sender, System.EventArg s e)
{
// Put user code to initialize the page here
SqlDataReader dataReader = null;

try
{
SqlConnection connection = new
SqlConnection(" Server=TestWebS erver;Database= Common;user id=myUserID;
password=myPass word");
SqlCommand command = new SqlCommand("Get NavigationMenu" , connection);
command.Command Type = CommandType.Sto redProcedure;
connection.Open ();
dataReader = command.Execute Reader();

while (dataReader.Rea d())
{
string headerMenu = (string)dataRea der["HeaderMenu "];
string sectionID = (string)dataRea der["SectionID"];
string navigationMenuI D = (string)dataRea der["NavigationMenu ID"];
string menuName = (string)dataRea der["MenuName"];
string pageUrl = (string)dataRea der["PageUrl"];
string ImageUrl = (string)dataRea der["ImageUrl"];
}

dataReader.Clos e();
connection.Clos e();
}

catch (System.Excepti on exception)
{
Response.Write( "Error: " + exception.ToStr ing());
return;
}

finally
{
if (dataReader != null)
{
dataReader.Clos e();
}
}
}


Dec 20 '05 #9
Did I say that you can't use them?
I only said that in a configuration that runs SQL and IIS (aspnet) on the
same box, you better use integrated security.
Note that from this code

SqlConnection(" Server=TestWebS erver;Database= Common;user id=myUserID;
> password=myPass word");

it's impossible for us to tell whether the specified credentials are correct
or that the Servername is correct, so to eliminate the credentials as a
possible cause, specify integrated security.
Note that, whatever the configuration is, you should always prefer
integrated security over explicit hard coded user credentials, especially
sa credentials.

Willy.
"Nate" <Na**@discussio ns.microsoft.co m> wrote in message
news:54******** *************** ***********@mic rosoft.com... I'm confused. If the connection string is specifying "User
Id=sa;Password= sa_password", then why in all of creation is ASP.NET
sending
credentials as ASPNET and not "sa"? What's the point in having SQL
credentials if you can't use them?

"Willy Denoyette [MVP]" wrote:
Set your connection string to use integrated security, and add NETWORK
SERVICE as a user and grant appropriate rights.
NT AUTHORITY\NETWO RK USER is the the default user running aspnet.
Note that I noticed that you are running IIS and SQL on the same box
(W2K3),
above is only applicable in such configuration.

Willy.

"Mike Collins" <Mi*********@di scussions.micro soft.com> wrote in message
news:9C******** *************** ***********@mic rosoft.com...
>I am trying to connect to a 2003 Server from an ASP.Net page and am
>getting
> the following error message. Can someone please help get me started on
> how
> to
> track and fix this error? The code I am using is below the error I am
> getting.
>
> Error: System.Data.Sql Client.SqlExcep tion: SQL Server does not exist or
> access denied. at
> System.Data.Sql Client.Connecti onPool.GetConne ction(Boolean&
> isInTransaction ) at
> System.Data.Sql Client.SqlConne ctionPoolManage r.GetPooledConn ection(SqlConne ctionString
> options, Boolean& isInTransaction ) at
> System.Data.Sql Client.SqlConne ction.Open() at
> testbed.Navigat ion.Page_Load(O bject sender, EventArgs e) in
> c:\documents
> and
> settings\collin ss\vswebcache\6 05webdev-2_443\testbed\n avigation.aspx. cs:line
> 31
>
> private void Page_Load(objec t sender, System.EventArg s e)
> {
> // Put user code to initialize the page here
> SqlDataReader dataReader = null;
>
> try
> {
> SqlConnection connection = new
> SqlConnection(" Server=TestWebS erver;Database= Common;user id=myUserID;
> password=myPass word");
> SqlCommand command = new SqlCommand("Get NavigationMenu" , connection);
> command.Command Type = CommandType.Sto redProcedure;
> connection.Open ();
> dataReader = command.Execute Reader();
>
> while (dataReader.Rea d())
> {
> string headerMenu = (string)dataRea der["HeaderMenu "];
> string sectionID = (string)dataRea der["SectionID"];
> string navigationMenuI D = (string)dataRea der["NavigationMenu ID"];
> string menuName = (string)dataRea der["MenuName"];
> string pageUrl = (string)dataRea der["PageUrl"];
> string ImageUrl = (string)dataRea der["ImageUrl"];
> }
>
> dataReader.Clos e();
> connection.Clos e();
> }
>
> catch (System.Excepti on exception)
> {
> Response.Write( "Error: " + exception.ToStr ing());
> return;
> }
>
> finally
> {
> if (dataReader != null)
> {
> dataReader.Clos e();
> }
> }
> }


Dec 20 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
1598
by: mike | last post by:
What is the proper method for setting up visual studio 2003 to store and run solutions on a windoes 2003 webserver? Using vstudio enterprise on a WinXP client. Major issue is that SafeSource says it can't check out .aspx items. Any docs on how to configure this? I guess it would be the same for deploying a solution to win2003 Server.
0
1374
by: Randy | last post by:
Hi all, I'm a developer on the database backend and need to figure out how to get a c++ .net executable to run on a win2003 server. The executable transfers data between oracla and sql server for datawarehousing. I dont know much ..net. It works fine on win2000 and my group has set up another win2000 server and migrated to that one OK....
1
2863
by: lhansen | last post by:
I've seen posts similar to this, but have not found the magic bullet to solve my problem.. I have an asp page (see source code below) running on IIS 6.0 on Win2003 Server that tries to get file and folder information on a Novell Server. I am able to successfully connect to the share on the Novell box if I use the UNC path. But,...
0
1529
by: CjB | last post by:
Good Morning, I am having some issues connecting to LDAP through PHP. I am using the function provided here: http://www.php.net/manual/en/function.ldap-bind.php (By 'edi01 at gmx dot at'). I don't get any errors till it tries to do the search. I get the following error: ldap_search(): Search: Operations error verification on...
3
5504
by: Steve Wark | last post by:
I have a Windows 2003 Web server on which I was debugging remotely with no problems. I then moved this server to a different domain and now remote debugging will not work, the error is; Auto-attach to process ' w3wp.exe' on machine 'CSS5' failed. Error code 0x80070005 (Access is denied. ). I have found a number of articles and it would...
6
1109
by: Wardeaux | last post by:
Is there an article on how to configure Win2003 so that I can use with Visual Studio for ASP.NET development? I loaded Win2003, copied over my previous ASP.NET code, and still can't load the projects... any hints on what I'm doing wrong? MTIA, wardeaux
1
4871
by: Jody Gelowitz | last post by:
We are having an issue in that when trying to read a file that is on Server2 from Server1 (through our ASP.NET project), we receive the error: Access to the path "\\Server2\MyShare\MyFile.tif" is denied. Here is the server setup that we have: Dev - Development Computer on WinXP Pro SP2 (IIS5), VS2003 developing under .NET Framework 1.1...
4
2302
by: klynn | last post by:
Hi: I'm having problems reading a Microsoft Access file from my ASP.Net app on a Windows Server 2003 machine. The error message: The Microsoft database engine cannot open the file, <my_file>. It is already opened exclusively by another user, or you need permission to view its data. I've read some info about this (microsoft support article...
0
1230
by: Tom | last post by:
When I try to connect to a MS SQL Server 2000 my application always crashes (without message). In the event log I find the following error: Faulting application testapp.exe, version 7.2.2368.12623, stamp 449f780f, faulting module mscorwks.dll, version 2.0.50727.42, stamp 4333e7ec, debug? 0, fault address 0x00046cb1. When I reinstall the...
0
7695
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7612
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7922
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8119
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7668
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6281
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5218
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3637
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
936
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.