0

Hi Folks,

I have created a login page that allows user to login to the system. I have a table in database called Users (userid, password, roleid) . When I try to login with proper user id and password the system let me login and redirects to proper page but if I use wrong password rather than giving me an error message the system generates an exception

"A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)"

I know that there is no connection error as when I use proper login credentials it let me in to the system. What is the potential cause of this behaviour ? I am using SQL Server 2008.

3
Contributors
4
Replies
5
Views
7 Years
Discussion Span
Last Post by Naresh Sharma
0

>What is the potential cause of this behaviour ? I am using SQL Server 2008.

MS-SQL server is not installed properly OR MS-SQL server instance is not started yet. I think you have MS-SQL 2008 Express edition.

0

>What is the potential cause of this behaviour ? I am using SQL Server 2008.

MS-SQL server is not installed properly OR MS-SQL server instance is not started yet. I think you have MS-SQL 2008 Express edition.

I am using MSSQL Server 2008 Standard Edition full version and not the Express Edition. If it is not installed properly then how can it allows user to login when credentials are correct. I only have this exception occurring when user fill wrong user id and password in login.aspx

0

Woohoo ... I solved the problem today....

The issue was rather strange. What was happening is I was using user name and password stored in my database table to login to the system. I also set up Forms based authentication to restrict users to access certain part of the website. The issue was not with the programming but with the behavior of ASP.NET and it was trying to find instance of SQLEXPRESS which is not there using LocalSqlServer connection string defined in IIS. So I removed LocalSqlServer in web.config and create a custom membership provider class that will use my own login logic to login to the system and set login control in my website to use that membership provider.

<remove name="LocalSqlServer" />
<membership defaultProvider="MyCustomMemershipProvider">
      <providers>
        <clear/>
        <add
          name="MyCustomMemershipProvider"
          type="BBCApplication.BusinessLogic.MyCustomMemershipProvider"/>
      </providers>
    </membership>
0

Hi Folks,
Hai,
Solution to you problem is that create a to layer under the app_code in the asp.net and inside it create foder business logic layer and data access layer and make a class inside these two layer for your login logic . Use AdO.net object data set with a dataset method in the code and create cookies of the userid inside the login button

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.