473,714 Members | 2,330 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Connecting to SQL Server from ASP.NET page using SqlClient namespa

I need to ask this question again because I am simply not getting it...

Can somebody please tell us what we need to do and explain the solution?
Please see the problem below.

Situation:
Using XP Pro development machine (VS 2003) trying to connect to a W2k3
server running SQL Server 2000 with ASP.NET (C#) using SqlClient.

SqlConnection objConn = new SqlConnection(" Trusted_Connect ion=no;User
ID=sa;Password= MySaPassword;In itial Catalog=MyDatab aseData
Source=MyRemote Server");
objConn.Open(); //.Open() generates an error.

Error: "SQL Server does not exist or access denied."

We are positive the connection string (creds, server, and database) are
correct because they work from a windows form application written in C#
(using exact same connection code). The firewall is not installed on the
server. Port 2433 is listening. We do know a work-around using
impersonation, but we are looking for an explanation. The W2k3 server is a
member of a domain (if that matters). The connection works when accessing a
W2k server just fine (of course changing only the server name in the
connection string).

One interesting thing is that the Event Viewer on the w2k3 server shows
failed login attempts for ASPNET. But, we are not accessing the database
using windows credentials, we are passing the credentials for SA. So, why is
ASPNET on my box trying to authenticate to the server? Shouldn't only the
credentials for SA be compared against SQL Servers internal security
mechanisms and leave the whole Windows security/authentication out of the
loop entirely.
Dec 21 '05 #1
5 1865
Hello Nate,

Hope this helps: http://support.microsoft.com/default.aspx?kbid=316989
N> Can somebody please tell us what we need to do and explain the
N> solution? Please see the problem below.
N> Situation:
N> Using XP Pro development machine (VS 2003) trying to connect to a
N> W2k3
N> server running SQL Server 2000 with ASP.NET (C#) using SqlClient.
N> SqlConnection objConn = new SqlConnection(" Trusted_Connect ion=no;User
N> ID=sa;Password= MySaPassword;In itial Catalog=MyDatab aseData
N> Source=MyRemote Server");
N> objConn.Open(); //.Open() generates an error.
N> Error: "SQL Server does not exist or access denied."

---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/members/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Dec 21 '05 #2
Thanks Michael, but that error relates to trusted connections. We are using
SQL Authentication and not Windows Authentication to connect.

After more research, we found that for some reason SQL Server was listening
on 2433 and not 1433. We did not configure it this way, and everytime we
change the port back to 1433 and restart SQL server it goes right back to
2433. The only information about this yields that it is caused by either
having VS.NET installed on the same box as SQL server, or the Slammer worm
patch.

So, if we change our connection string to:
Trusted_Connect ion=no;User ID=sa;Password= MySaPassword;In itial
Catalog=MyDatab aseData;
Source=MyRemote Server,2433

(notice the ,2433 at the end of the server name)

This is a viable workaround, but we don't like workarounds. We would
prefer that the software function as it was designed to. So, the question
now is, how come SQL server is not letting us change the port that it listens
on? Is it because of VS.NET or the Slammer worm patch?

Thank you in advance.

"Michael Nemtsev" wrote:
Hello Nate,

Hope this helps: http://support.microsoft.com/default.aspx?kbid=316989
N> Can somebody please tell us what we need to do and explain the
N> solution? Please see the problem below.
N> Situation:
N> Using XP Pro development machine (VS 2003) trying to connect to a
N> W2k3
N> server running SQL Server 2000 with ASP.NET (C#) using SqlClient.
N> SqlConnection objConn = new SqlConnection(" Trusted_Connect ion=no;User
N> ID=sa;Password= MySaPassword;In itial Catalog=MyDatab aseData
N> Source=MyRemote Server");
N> objConn.Open(); //.Open() generates an error.
N> Error: "SQL Server does not exist or access denied."

---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/members/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche

Dec 21 '05 #3
I guess you are running "SQL Express" which has the "Hide server option" set
by default. This has the effect of having SQL server to listen on port 2344,
whenever you change the listener port, it will set back to 2433 when SQL
server restarts. I'm not quite sure you can disable this "feature" for SQL
Express, IMO SQL Express was not supposed to be running on the same box as
it's clients.

Willy.
l

"Nate" <Na**@discussio ns.microsoft.co m> wrote in message
news:01******** *************** ***********@mic rosoft.com...
Thanks Michael, but that error relates to trusted connections. We are
using
SQL Authentication and not Windows Authentication to connect.

After more research, we found that for some reason SQL Server was
listening
on 2433 and not 1433. We did not configure it this way, and everytime we
change the port back to 1433 and restart SQL server it goes right back to
2433. The only information about this yields that it is caused by either
having VS.NET installed on the same box as SQL server, or the Slammer worm
patch.

So, if we change our connection string to:
Trusted_Connect ion=no;User ID=sa;Password= MySaPassword;In itial
Catalog=MyDatab aseData;
Source=MyRemote Server,2433

(notice the ,2433 at the end of the server name)

This is a viable workaround, but we don't like workarounds. We would
prefer that the software function as it was designed to. So, the question
now is, how come SQL server is not letting us change the port that it
listens
on? Is it because of VS.NET or the Slammer worm patch?

Thank you in advance.

"Michael Nemtsev" wrote:
Hello Nate,

Hope this helps: http://support.microsoft.com/default.aspx?kbid=316989
N> Can somebody please tell us what we need to do and explain the
N> solution? Please see the problem below.
N> Situation:
N> Using XP Pro development machine (VS 2003) trying to connect to a
N> W2k3
N> server running SQL Server 2000 with ASP.NET (C#) using SqlClient.
N> SqlConnection objConn = new SqlConnection(" Trusted_Connect ion=no;User
N> ID=sa;Password= MySaPassword;In itial Catalog=MyDatab aseData
N> Source=MyRemote Server");
N> objConn.Open(); //.Open() generates an error.
N> Error: "SQL Server does not exist or access denied."

---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/members/laflour

"At times one remains faithful to a cause only because its opponents do
not
cease to be insipid." (c) Friedrich Nietzsche

Dec 22 '05 #4
Hello Willy Denoyette [MVP],

There is the answer of how to change SQLExpress port http://mattwoodward.com/blog/index.cfm?commentID=211

W> I guess you are running "SQL Express" which has the "Hide server
W> option" set by default. This has the effect of having SQL server to
W> listen on port 2344, whenever you change the listener port, it will
W> set back to 2433 when SQL server restarts. I'm not quite sure you can
W> disable this "feature" for SQL Express, IMO SQL Express was not
W> supposed to be running on the same box as it's clients.
W>
W> Willy.
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/members/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Dec 22 '05 #5
Sorry for not specifying...

The version installed is SQL Server 2000 Enterprise Edition.

"Willy Denoyette [MVP]" wrote:
I guess you are running "SQL Express" which has the "Hide server option" set
by default. This has the effect of having SQL server to listen on port 2344,
whenever you change the listener port, it will set back to 2433 when SQL
server restarts. I'm not quite sure you can disable this "feature" for SQL
Express, IMO SQL Express was not supposed to be running on the same box as
it's clients.

Willy.
l

"Nate" <Na**@discussio ns.microsoft.co m> wrote in message
news:01******** *************** ***********@mic rosoft.com...
Thanks Michael, but that error relates to trusted connections. We are
using
SQL Authentication and not Windows Authentication to connect.

After more research, we found that for some reason SQL Server was
listening
on 2433 and not 1433. We did not configure it this way, and everytime we
change the port back to 1433 and restart SQL server it goes right back to
2433. The only information about this yields that it is caused by either
having VS.NET installed on the same box as SQL server, or the Slammer worm
patch.

So, if we change our connection string to:
Trusted_Connect ion=no;User ID=sa;Password= MySaPassword;In itial
Catalog=MyDatab aseData;
Source=MyRemote Server,2433

(notice the ,2433 at the end of the server name)

This is a viable workaround, but we don't like workarounds. We would
prefer that the software function as it was designed to. So, the question
now is, how come SQL server is not letting us change the port that it
listens
on? Is it because of VS.NET or the Slammer worm patch?

Thank you in advance.

"Michael Nemtsev" wrote:
Hello Nate,

Hope this helps: http://support.microsoft.com/default.aspx?kbid=316989
N> Can somebody please tell us what we need to do and explain the
N> solution? Please see the problem below.
N> Situation:
N> Using XP Pro development machine (VS 2003) trying to connect to a
N> W2k3
N> server running SQL Server 2000 with ASP.NET (C#) using SqlClient.
N> SqlConnection objConn = new SqlConnection(" Trusted_Connect ion=no;User
N> ID=sa;Password= MySaPassword;In itial Catalog=MyDatab aseData
N> Source=MyRemote Server");
N> objConn.Open(); //.Open() generates an error.
N> Error: "SQL Server does not exist or access denied."

---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/members/laflour

"At times one remains faithful to a cause only because its opponents do
not
cease to be insipid." (c) Friedrich Nietzsche


Dec 22 '05 #6

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

Similar topics

2
1946
by: Irishmaninusa | last post by:
I have a client who is trying to connect to a sql server database using asp.net and this is the error message that they get, any ideas on what is causing the error message and what the correction for this. Code they are using <%@ Page Language="VB" Debug="true" %> <%@ Import Namespace="System.Data" %> <%@ Import Namespace="System.Data.SqlClient" %>
4
1799
by: CodeImp | last post by:
A simple app I quickly wrote to try getting info from a database. Here is the first part of its code. The rest of the code is irellevant. using System; using System.Data; using System.Data.SqlClient; using System.Threading; namespace TestSQL { class Class1
1
1369
by: dk | last post by:
this is the DSN connection string in web.confi <add key="DSN" value="server=localhost;database=userDB;Integrated Security=SSPI" / any idea regarding what is causing this following error message when the connection object trys to open tia d Server Error in '/FormsAuth' Application -------------------------------------------------------------------------------
1
254
by: Mohammad-Reza | last post by:
It is now 3 months that we are trying to connect ASP.NET to a SQLServer located on another system However we act,we get a fatal error We need someone to explain the way of connecting to SQLServer step by step from either VisualStudio.NET or FrontPage 2003 Our goal is to retrieve records from SQLServer and display them in ASP.NET pages,edit them,and return them to SQLServer Thanx in advance.
1
2606
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 runs on the server with a connection to the campus database and we make calls to it. My question is, how best to connect to this object via asp.net, in an aspx page?. The example I had used a console ap to connect and that works, but we want to...
12
2785
by: Ann Marinas | last post by:
Hi all, I would like to ask for some help regarding separating the asp.net webserver and the sql server. I have created an asp.net application for a certain company. Initially, we installed both the iis and sql server in a single machine. Not too long ago, the machine had some hardware problems, and management has decided to purchase new servers, for both asp.net and sql server.
10
1429
by: Mike Collins | last post by:
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.SqlClient.SqlException: SQL Server does not exist or access denied. at System.Data.SqlClient.ConnectionPool.GetConnection(Boolean& isInTransaction) at...
3
3001
by: Ann Marinas | last post by:
Hi there, I am currently developing an ASP.NET program that connects to a SQL Server 2000 database. I also have SQL Server 2005 Express installed on the same local machine. Prior to installing SQL Server 2005, my apps were working and is connecting flawlessly to a database on the SQL Server 2000. Now, whenever I connect to the same database with the 2005 version installed, I keep on getting this error:
0
2005
by: aboutjav.com | last post by:
Hi, I need some help. I am getting this error after I complete the asp.net register control and click on the continue button. It crashed when it tries to get it calls this Profile property ((string)(this.GetPropertyValue("Address1")));
0
8711
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9314
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9075
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
7953
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6634
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5948
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3158
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2522
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2111
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.