Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Server connection problems with Web app
Message
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Miscellaneous
Thread ID:
00842544
Message ID:
00842550
Views:
13
Hi Pertti,

ASP.NET applications run un the ASPNET account even though the server has someone else logged in. You can change your connection string to include the username and password and remove Integrated Security or you can impersontate a user on your system. ASP.NET will then use that user instead of the ASPNET account. The thrid option is to grant rights to the ASPNET account.

>When I try to access SQL Server 2000 from my MM.NET app, I get the following errors:
>
>Server Error in '/Webpermits' Application.
>--------------------------------------------------------------------------------
>
>Login failed for user 'MAIN\ASPNET'.
>Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
>
>Exception Details: System.Data.SqlClient.SqlException: Login failed for user 'MAIN\ASPNET'.
>
>Source Error:
>
>
>Line 22: public DataSet GetPermitsByStreetName(string bstr_name)
>Line 23: {
>Line 24: return this.GetDataSet("SELECT * From Permits WHERE BSTR_NAME = '" +
>Line 25: bstr_name + "'");
>Line 26: }
>
>
>Source File: c:\webpermits\web permits business objects csharp\permits.cs Line: 24
>
>Stack Trace:
>
>BlahBlahBlah
>
>***
>
>I have the following line in web.config for Windows authentication:
>
>add key="WebPermits\Connection" value="server=Main;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=WebPermits"
>
>I can connect to this database just fine from Enterpise manager and ODBC manager. I wonder why it is saying specifically that "Login failed for user 'MAIN\ASPNET'.", when my Windows XP username and password are something totally different? I tried SQL server authentication, as well, but to no avail. Can't figure it out, elemental as it might be.
>
>What might be going on here?
-----------------------------------------

Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.com
www.prenia.com
Weblog: blogs.prenia.com/cathi
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform