Re: sqlserver connection - need help desperately!
- From: "Juan T. Llibre" <nomailreplies@xxxxxxxxxxx>
- Date: Sat, 17 Sep 2005 02:36:39 -0400
For additional information, see :
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag2/html/paght000008.asp
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/
======================================
"Juan T. Llibre" <nomailreplies@xxxxxxxxxxx> wrote in message
news:un%23V2rruFHA.3756@xxxxxxxxxxxxxxxxxxxxxxx
> Let's summarize :
>
> You are connecting to a remote ( not on your box ) SQL Server
> which is not connected to the internet.
>
> You can connect from within VS.NET, but fail when connecting
> from ASP.NET when you use the connection strings :
>
>> "Data Source=SERVERNAME;Initial Catalog=DATABASE;Persist Security Info=True;User
>> ID=sa;Password="
> and
>> "data source=SERVERNAME;initial catalog=DATABASE;user id=sa"
>
> The SQL Server accepts both Windows and SQL Server authentication.
>
> Given these conditions, you are getting denied access because when
> ASP.NET connects to your SQL Server the credentials it passes
> are those of the user account under which ASP.NET is running
> on your IIS Server, and that is *not* the "sa" user, which is the
> SQL Server login that's authorized to use your database.
>
> If you can create a SQL Server login which matches your current
> ASP.NET account's name *and* password, you'll surpass the
> credentials problem.
>
> In practice, though, recreating the ASP.NET password is not an easy task,
> because the default setup for ASP.NET sets up an auto-generated password,
> and that is a stumbling block to creating a login with the same password for
> the ASP.NET account in the SQL Server.
>
> To bypass that problem, you will have to setup a custom account to run
> ASP.NET as ( so you can set the password ), enable impersonation,
> and setup a login, with *exactly* the same name and password as the
> ASP.NET account, in the SQL Server.
>
> Now, in the <process model> section of your web.config, instead of using :
>
> userName="machine" password="AutoGenerate"
>
> you'd use : userName="YourNewASPNETAccount" password="Your7Strong9Pwd"
>
> That way, you can repro the password in your SQL Server login.
>
> See :
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/SecNetHT01.asp
> for how to do this, including the setting of the security permissions
> for the directories to which the ASP.NET account must have access to.
>
> Note: the article refers to v1.0 and that's the directory path used.
> Since you are using ASP.NET 1.1, use v1.1.4322 instead.
>
> In summary, you need to :
>
>
> 1. Create a New Local Account
> 2. Assign Minimum Privileges
> 3. Assign NTFS Permissions
> 4. Configure ASP.NET to Run Using the New Account
> 5. Create a login in your SQL Server with the
> same name as your new ASP.NET account.
> 6. Assign database permissions in the SQL Server to your new login.
>
> You should be able to connect after you do that.
>
>
>
> 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/
> ======================================
>
> "peshekeedweller" <someone@xxxxxxxxxxxxx> wrote in message
> news:klkWe.44413$AI1.33393@xxxxxxxxxxxxxxxxxxxxxxxxx
>> Sorry Juan, still didin't work. Got exactly the same result.
>>
>> And it is a development sql server with only 3 users and is not exposed to the
>> internet. That's why I don't assign password to the sa account.
>>
>>
>> "Juan T. Llibre" <nomailreplies@xxxxxxxxxxx> wrote in message
>> news:%230Jz4fiuFHA.2960@xxxxxxxxxxxxxxxxxxxxxxx
>>>
>>> Try :
>>>
>>> "Data Source=SERVERNAME;Initial Catalog=DATABASE;Persist Security Info=True;User
>>> ID=sa;Password="
>>>
>>> instead of
>>>
>>> "data source=SERVERNAME;initial catalog=DATABASE;user id=sa"
>>>
>>> Although why you would use a blank password for the sa user is beyond me.
>>>
>>>
>>>
>>> Juan T. Llibre
>>> ASP.NET MVP
>>> ASP.NET FAQ : http://asp.net.do/faq/
>>> ==========================
>>>
>>> "peshekeedweller" <someone@xxxxxxxxxxxxx> wrote in message
>>> news:5njWe.29993$1z2.23041@xxxxxxxxxxxxxxxxxxxxxxxxx
>>>> Curt, I can create a successful connection in the data link wizard; I can create a
>>>> successful connection in the Vis Studio Server Explorer; I can create a succesful
>>>> server in the Vis Studio Server Explorer. But none of the connection strings work in
>>>> code. Even trying to use a SQLDataAdapter component with a connection string created
>>>> successfully in Server Explorer fails when compiled and run.
>>>>
>>>> What the heck is going on?
>>>>
>>>>
>>>> "Curt_C [MVP]" <software_at_darkfalz.com> wrote in message
>>>> news:D08E4C64-A17D-4889-AEF7-2211FA2C045C@xxxxxxxxxxxxxxxx
>>>>> I'd suspect its not that it doesnt exist, its that you are being denied. Try
>>>>> looking at this http://www.darkfalz.com/1059 to create the connection
>>>>> string. So this on the VPC session, that way you know you got your access
>>>>> correct before you try to do it with code.
>>>>>
>>>>> --
>>>>> Curt Christianson
>>>>> site: http://www.darkfalz.com
>>>>> blog: http://blog.darkfalz.com
>>>>>
>>>>>
>>>>>
>>>>> "peshekeedweller" wrote:
>>>>>
>>>>>> Using asp.net 1.1. vb.net 2003.
>>>>>>
>>>>>> I am trying to connect to a remote sql server 2000 on a virtual machine
>>>>>> running windows 2000 server. I can connect through the server explorer in
>>>>>> visual studio, but cannot connect through code. I have done it before and
>>>>>> can not do it now; I don't know what changed. (I also cannot connect to
>>>>>> local Access database through code though I can from server explorer.)
>>>>>>
>>>>>> The code is:
>>>>>> conn = New SqlConnection("data source=SERVERNAME;initial
>>>>>> catalog=DATABASE;user id=sa")
>>>>>>
>>>>>> Code fails at "conn.open", returning the following error message: "SQL
>>>>>> Server does not exist or access denied."
>>>>>>
>>>>>> SQL Server authentication is set to "sqlsever and windows" and, of course,
>>>>>> the "sa" account exists, with no password (though it doesn't work when I set
>>>>>> a password either).
>>>>>>
>>>>>> Please help. I'm really getting desperate, here.
>>>
>>>
>>
>>
>
>
.
- Prev by Date: Re: Cookies:Sites which always work
- Next by Date: RE: HTTPWebRequest Date Header
- Previous by thread: Re: sqlserver connection - need help desperately!
- Next by thread: Re: Unique Login
- Index(es):
Relevant Pages
|