Cause and solution of Logon Failure of ***/aspnet' in Asp.net

Source: Internet
Author: User

1. if this occurs on the local machine, select the corresponding database in the Console Directory of the SQL Server Enterprise Manager and right-click the user section under it to create a database user, add ***/ASPNET users and grant them public permissions.

 

2. If it appears on another computer, check whether the connection string connecting the program to sqlserver is logged on using Windows integration. This problem is generally caused by the use of Windows integrated login. In this case, you can log on with a database account and password, for example, Server = localhost; uid = sa; Pwd = xxxx; database = Master.

3. Knowledge of some common keywords in SQL connection characters

 

Security Support Provider Interface
When the value of integrated security is set to true, the user ID in front of the connection statement PW does not work, that is, the Windows Authentication mode is used.
The connection is based on userid and PW only when it is set to false or this item is omitted.
Integrated security can be set to: True, false, yes, no. The four values are clear and can also be set to: sspi, which is equivalent to true. We recommend that you use this instead of true.

What is the difference between initial catalog and database?
Initial catalog:
Database:
There is no difference between the two, but the names are different, just like the real names of humans and old names .. Can call you.

**************************************** ****

Integrated Security = sspi indicates that the current Windows system user logs on to the SQL Server server. If the SQL Server server does not support this method, an error occurs.
You can use the username and password of SQL Server to log on, for example:
"Provider = sqloledb.1; persist Security info = false; initial catalog = database name; Data Source = 192.168.0.1; user id = sa; Password = password"

**************************************** ***********

If the value of integrated security-or-trusted_connection 'false' is false, the user ID and password are specified in the connection. If this parameter is set to true, the current Windows Account creden。 are used for authentication. The identifiable values are true, false, yes, no, and sspi equivalent to true (strongly recommended ).

**************************************** *********

Database Connection Method in ado.net
System. Data. sqlclient. sqlconnection
Commonly used connection strings (C # code ):

Sqlconnection conn = new sqlconnection ("Server = (local); Integrated Security = sspi; database = pubs");

Sqlconnection conn = new sqlconnection ("Server = (local)/netsdk; database = pubs; Integrated Security = sspi");

Sqlconnection conn = new sqlconnection ("Data Source = localhost; Integrated Security = sspi; initial catalog = northwind;");

Sqlconnection conn = new sqlconnection ("Data Source = (local); initial catalog = XR; Integrated Security = sspi;
Persist Security info = false; workstation id = xurui; packet size = 4096; ");

Sqlconnection myconn = new system. Data. sqlclient. sqlconnection ("persist Security info = false; Integrated
Security = sspi; database = northwind; server = mysqlserver ");

Sqlconnection conn = new sqlconnection ("uid = sa; Pwd = passwords; initial catalog = pubs; Data Source = 127.0.0.1; Connect timeout = 900");

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.