473,569 Members | 2,698 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 1857
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
1943
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...
4
1785
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
1360
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...
1
2600
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,...
12
2763
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...
10
1418
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...
3
2992
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...
0
1988
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
7697
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
7968
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5512
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...
0
5219
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
3640
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2113
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
1
1212
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
937
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.