Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error When Viewing ASP Pages w/ ConnectionString

Status
Not open for further replies.

MCuthill

Technical User
Jul 19, 2006
669
CA
Hi All,

I have been developing an online library for our HR department, and all works just fine on my (development) machine, but I am getting a runtime error after moving it to the IIS server.

Any basic page (just textual information) works just fine, but the pages that utilize a ConnectionString to connect to the resource database get a runtime error.

I am quite new to ASP.NET and am unsure where to start with the debugging of this issue.

Any direction would be greatly appreciated,

Mike
______________________________________________________________
[banghead] "It Seems All My Problems Exist Between Keyboard and Chair"
 
I guess that either:

1) The connection string is wrong (which in theory it shouldn't be as it works locally)

2) The server doesn't have access to the database (either it can't see it or it doesn't have the correct permissions).


____________________________________________________________
Mark,
[URL unfurl="true"]http://aspnetlibrary.com[/url]

Need help finding an answer? Try the Search Facility or read FAQ222-2244.
 
ca8msm,

I tried running the website within IIS and for the pages I get a runtime error in IE, I get the following in IIS:

Code:
Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'. 
[b]Description:[/b] 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. 

[b]Exception Details:[/b] System.Data.SqlClient.SqlException: Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'.

If there a means of statically defining an account to use in place of the anonymous one? Would this fall under your second assuption of the server not having access to the Data?

Thanks,

Mike
______________________________________________________________
[banghead] "It Seems All My Problems Exist Between Keyboard and Chair"
 
Yes that error means that you don't have access to the data. You can turn off anonymous access in IIS (if that's what you want to do). By default, ASP.NET applications will run under the ASPNET account (or NETWORK SERVICE on a windows 2003 machine). You basically have to add whatever account you are using to a login in SQL Server (if you are using windows authentication).


____________________________________________________________
Mark,
[URL unfurl="true"]http://aspnetlibrary.com[/url]

Need help finding an answer? Try the Search Facility or read FAQ222-2244.
 
ca8msm,

I have tried a few scenarios and seem to be no closer to resolution.

My first test was to change the account the site uses for Anon Authentication, I used our SQL account as per recommendation from my manager - but this resulted in the same error message.

The second test was disabling anonymous authentication and using windows auth instead. By doing this I was presented with a prompt to login to the website (of which there are no users, as it using windows authentication which worked in testing).

The question my manager posed is if there is a different means by which to authenticate a user when then are logged onto their own machine, but the website stored on the IIS server.

Is this all that is needed to authenticate a user via Windows Authentication?
excerpt from web.config:
Code:
<!--
     The <authentication> section enables configuration 
     of the security authentication mode used by 
     ASP.NET to identify an incoming user. 
-->
     <authentication mode="Windows"/>

Thanks for your assistance,


Mike
______________________________________________________________
[banghead] "It Seems All My Problems Exist Between Keyboard and Chair"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top