Re: connection sql server with asp.net

From: Paul Ibison (Paul.Ibison_at_Pygmalion.Com)
Date: 04/24/04


Date: Sat, 24 Apr 2004 14:52:42 +0100

Zalizan,

if you open Administrative Tools, Internet Service Manager, open up your
website, right-click and go to properties. On directory security, click
edit, and the top check box will show if you have enabled anonymous. It is
enabled by default. As far as asp.net is concerned, unless you are using
impersonation (not on by default) you will be using a windows user called
ASPNET if your connectionstring selects trusted security. The "ASPNET" user
account is created in Windows by Microsoft .NET Framework. It is an
automatic machine account created to limit access rights of .NET
applications. In your case I believe this account should be added as a login
to SQL Server.

To be sure of using the correct connection string syntax, you could create a
UDL file. To get the udl file to open, create a blank textfile named as
xxx.udl. Then double click it to go through the wizard. Inside the udl file
(if you open using notepad) will be the connection string in the correct
format. The connection object is set using this string as follows:

SQL:
cn.ConnectionString = "Provider=SQLOLEDB.1;Persist Security Info=False;User
ID=name;Password=password;Initial Catalog=database;Data Source=servername"

Trusted:
cn.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist
Security Info=False;
Initial Catalog=database;Data Source=servername"

hope this helps,
Paul Ibison



Relevant Pages

  • Re: Problems accessing the ASPNETDB.MDF file
    ... I have no connection string to in my config ... Nicole Calinoiu wrote: ... If you can't use IIS Manager on the server, you can access the account ...
    (microsoft.public.dotnet.security)
  • Re: Help with connection string
    ... The connection string looks correct. ... Is that E drive accessible to the user account under whose context the ... IIS process is running (if your website has Anonymous enabled, ... connect to an unpassworded Access 2007 database for use in a small ...
    (microsoft.public.inetserver.asp.db)
  • Re: dynamic connection string
    ... Aside from the use of the sa account, ... If i replace the variable being supplied to Data Source with a hard ... coded server name, the connection string does work. ...
    (microsoft.public.inetserver.asp.db)
  • Re: Bizzare SQL Network Error
    ... Try making sure the SQL account that you put into the connection string ... The reason the Windows app worked was because it used the account of the ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Need Local Connection String to SQL Server for Classic ASP
    ... You cannot tell which windows account to use in a connection string. ... I definitely have a database established with SQL Server called ...
    (microsoft.public.sqlserver.connect)