Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / October 2005

Tip: Looking for answers? Try searching our database.

SQL Server Authentication from IIS

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
ryan.d.rembaum@kp.org - 27 Oct 2005 23:14 GMT
Hello,

I have read a bunch of topics on this issue but none seems to have
resolved my problem.  I have set up a user account in my SQL server
database.  e.g. User: TheUser Password: Password  and assigned it as a
datareader with the ability to issue SELECT statements on one table.

On a separate IIS server I am running a page that makes a connection to
this database.  I have tried a bunch of connection strings and though I
can connect using the SQLDataConnection wizard in .net 2003 Interdev,
Windows ODBC, etc.  When I actually browse to test the page using the
same connection string I get the message that:

SQL Server does not exist or access denied.

I do not want to Impersonate and existing account.  I have enabled
Anonymous access in IIS.  I do not want Windows Integrated Security.
An example of a connection string I that works within .net studio
(development) but now actuall when the ASP page is accessed via
localhost is:

"workstation id=myworkstation;packet size=4096;user id=TheUser;data
source=myserver;persist security info=True;initial
catalog=MyDB;password=password"

What am I doing wrong?

Thanks,
Ryan
Bruce Barker - 28 Oct 2005 00:56 GMT
you need to turn on mixed security on the sqlserver box, you you can
actually use a standard login.

-- bruce (sqlwork.com)

> Hello,
>
[quoted text clipped - 25 lines]
> Thanks,
> Ryan
ryan.d.rembaum@kp.org - 28 Oct 2005 01:25 GMT
Mixed security is turned on.  I am going to repost this in the news
group Mark suggested. If you can think of some other causes for this
can you please respond to me there!  Thanks Bruce!
ryan.d.rembaum@kp.org - 28 Oct 2005 17:49 GMT
OK, just got notified by a Microsoft MVP that this is indeed the
correct newgroup to be posting to since this is an ASP .NET issue.
Please, I don't really care too much where people post a response, if
you know the answer this problem has been driving me crazy for days! :)
ryan.d.rembaum@kp.org - 28 Oct 2005 18:17 GMT
OK, just got notified by a Microsoft MVP that this is indeed the
correct newgroup to be posting to since this is an ASP .NET issue.
Please, I don't really care too much where people post a response, if
you know the answer this problem has been driving me crazy for days! :)
ryan.d.rembaum@kp.org - 28 Oct 2005 18:43 GMT
PS.  This is my fault, I mistakenly wrote ASP page above...should have
read aspX page ;)
ryan.d.rembaum@kp.org - 28 Oct 2005 18:55 GMT
Let me ask this, does Windows still try to authenticate under the
service account to the SQL Server box even if you are trying to use SQL
Authentication to make the connection.  In other words, if were to
impersonate say, myself, with administrative rights (which I don't want
to do), and still try to use SQL Authentication, would the system let
me on?  I guess what I am asking is whether I have to setup some WinNT
server permission in order to even attempt to use SQL Authentication?
Juan T. Llibre - 28 Oct 2005 20:30 GMT
If you are impersonating, the credentials sent to SQL Server
will be those of the account you're impersonating, unless you
specify a particular account in the connection string.

For that to be sucessful (specifying a particular account in the connstring),
you need to allow SQL Server authentication, not Windows authentication.

If you are using Windows authentication, the account credentials sent to
SQL Server will be those of the Windows account which ASP.NET is running as.

Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
Foros de ASP.NET en Español : http://asp.net.do/foros/
======================================
> Let me ask this, does Windows still try to authenticate under the
> service account to the SQL Server box even if you are trying to use SQL
[quoted text clipped - 3 lines]
> me on?  I guess what I am asking is whether I have to setup some WinNT
> server permission in order to even attempt to use SQL Authentication?
ryan.d.rembaum@kp.org - 28 Oct 2005 18:55 GMT
Let me ask this, does Windows still try to authenticate under the
service account to the SQL Server box even if you are trying to use SQL
Authentication to make the connection.  In other words, if were to
impersonate say, myself, with administrative rights (which I don't want
to do), and still try to use SQL Authentication, would the system let
me on?  I guess what I am asking is whether I have to setup some
Win2000 server permission in order to even attempt to use SQL
Authentication?
Juan T. Llibre - 28 Oct 2005 18:20 GMT
If you have setup a specific user in the SQL Server DB, and you have
setup SQL Server to use "mixed authentication", i.e., both Windows and
SQL Server authentication, use this for your connection string :

"SERVER=yourSqlServer;UID=TheUser;DataBase=YourDB;PWD=Password"

Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
Foros de ASP.NET en Español : http://asp.net.do/foros/
======================================
> Hello,
>
[quoted text clipped - 25 lines]
> Thanks,
> Ryan
ryan.d.rembaum@kp.org - 28 Oct 2005 18:50 GMT
Still did not work:

Source File: C:\Inetpub\wwwroot\MFAP\login.aspx.vb    Line: 80

Stack Trace:

[SqlException: SQL Server does not exist or access denied.]
  System.Data.SqlClient.ConnectionPool.GetConnection(Boolean&
isInTransaction) +472

System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString
options, Boolean& isInTransaction) +372
  System.Data.SqlClient.SqlConnection.Open() +384
  MFAP.login.DBAuthenticate(String strUID, String strpswd) in
C:\Inetpub\wwwroot\MFAP\login.aspx.vb:80
  MFAP.login.BtnLogin_Click(Object sender, EventArgs e) in
C:\Inetpub\wwwroot\MFAP\login.aspx.vb:63
  System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108

System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
eventArgument) +57
  System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument) +18
  System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
+33
  System.Web.UI.Page.ProcessRequestMain() +1277
Ryan - 28 Oct 2005 23:18 GMT
Also, this is in my web config by default.  Do I need to change this???

           mode="InProc"
           stateConnectionString="tcpip=127.0.0.1:42424"
           sqlConnectionString="data
source=127.0.0.1;Trusted_Connection=yes"
           cookieless="false"
           timeout="20"
Juan T. Llibre - 28 Oct 2005 23:48 GMT
Not unless you want to maintain state with State Server or SQL Server.

That doesn't affect your SQL Server connections.

Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
Foros de ASP.NET en Español : http://asp.net.do/foros/
======================================
> Also, this is in my web config by default.  Do I need to change this???
>
[quoted text clipped - 4 lines]
>            cookieless="false"
>            timeout="20"

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.