Friday, February 24, 2012

Login Problems using .net 2 Login Control

Hi There,

I have a really strange problem. I am creating a website with an administration back end. We have a seperate sql 2000 server which we are using hold authentication credientials (after having used the aspnet_regsql.exe to setup the appropriate tables.

When testing the application on the local machine, everything works fine. The web admin works, I can login, I can retrieve data to display on the rest of the site. Once uploaded to the live environment things change.

I can still connect to the sql server i.e. I have information being displayed on the public area of the site which is coming from the sql 2000 db. I can type in the incorrect login details to the admin section of the site and the system will return an error, which is correct as well, however, if I type in the correct login information, the page hangs for awhile and then displays this error: My question is, why is it doing this when it works find on my local box and the DB connection is actually working on other parts of the site? Can anyone help?

An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

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: An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

Make sure TCP/IP activated as a connection method to the sql server and firewall doesn't block the connection.

|||

HI.

There is no firewall between the two servers and TCP/IP is enabled. The fact is, a connection is working elsewhere on the site, but the login just doesnt work.

|||How do you know the connection is working? Do you mean the conneciton can be established to the remote SQL 2000 instance? You can turn on Audit Login for the SQL 2000 instance (right click the instance in Enterprise Manager->check Properties->switch to Security tab->change the Audit Level to All->restart server, then if there is any login failure, you can find the login failure error message in SQL ERRORLOGs.|||

I think I have figured out what the problem is. I had the membership data source defined but not the roles, this meant that the roles were being stored in the sqlexpress DB while the membership details were being stored on SQL 2000. On my local machine, it could see both DB but when uploaded to the servers (that do not support sqlexpress DB) it was failing to connect once a successful login was taking place and roles needed to be allocated.

Pity the error reported gave no indication of what the problem really was.

Now I am having issues with creating the necessary permissions tables on the server. Once I get it all going and tested, I will clost this post as being solved.

No comments:

Post a Comment