ConnectionStrings in web.config configuration file

I am trying to setup complete Microsoft SQL Server to another machine, for this I successfully restored db into Microsoft SQL Server Express 2008 R2 version from Microsoft SQL server 2000 version.

Now I am using ASP.NET and Microsoft SQL Server 2008 R2 Express for creating asp.net forms authentication , the .aspx.file is not connected to a database, I got an error like Login failed for user 'vinay' while compiling .aspx file on browser with IP Address. I gave database authentication in web.config file, Is anywhere wants to give database authentication other than web.config file. My database name is : CPS, password is: Indi123$, userId is : vinay and I server Name: my system name i.e, IV-27, but I have a doubt why we are using key in connectionString, my statement in web.cofig for database connection is  <add key="CPSWebAppl" value="Server=IV-27;Database=CPS;UId=vinay;Password=Indi123$;" />

Below is the attachment of I got error while compiling .aspx file on browser with IP Addressgetting error while compiling .aspx file on browser with IP Address.

Please help me to compile with IP address in browser.
Keerthi KamarthiAsked:
Who is Participating?
 
Shaun VermaakTechnical Specialist/DeveloperCommented:
SQL Express connection string server is usually .\SQLExpress

Something like
Server=.\SQLExpress;AttachDbFilename=C:\MyFolder\MyDataFile.mdf;Database=dbname;Trusted_Connection=Yes;

Open in new window

https://www.connectionstrings.com/sql-server/
1
 
Martin MillerCTOCommented:
Please try a  manual SQL-Client application first, with this setting for user and password.

If this does not work, your web.config won't either...

You want to eliminate the easy problem first, then work on network and security challenges.

Martin
0
 
Vitor MontalvãoMSSQL Senior EngineerCommented:
Hopefully you're using a  Server, User ID and Password as isn't good idea to post those kind of information in a public website.
0
 
Alan WarrenApplications DeveloperCommented:
If you are using the ASP .Net membership server and login controls, the most likely issue you would encounter when migrating your application to another machine is an ApplicationID mismatch. In the sql table [dbo].[aspnet_Applications], you would generally have only one record and all your users in the table [dbo].[aspnet_Membership] would be associated/bound to the ApplicationID in the table [dbo].[aspnet_Applications]. When you are attempting to login using an ASP .Net login control, the ApplicationID is parsed to the SQL server, if you have created a new application on a new machine or migrated an existing application to a new machine, there is a possibility the ApplicationID being parsed by the login controls is different to what is stored in the tables [dbo].[aspnet_Applications] and [dbo].[aspnet_Membership] . An easy way to test this is to create a new user using the create new user form/wizard in your new application on the new machine and then check the table [dbo].[aspnet_Applications] for a new record. If you do have a new record, you may need to update your existing records in the [dbo].[aspnet_Membership] table to use the new ApplicationID. Perhaps try it with one user record first, maybe vinay. I believe that password recovery can be affected by using this method because the algorithm that decrypts passwords uses a combination of  ApplicationID, UserID and Answer to secret question to decrypt, so you may need to reset your security credentials after updating the applicationID associated with your membership.userID.
0
 
Martin MillerCTOCommented:
Can we close this?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.