my web application connect with database from one windows user account but not with second windows user account
I create a web application in visual studio 2010 (mvc3 razor) and use my own database in sql server 2008 r2 and added aspdbnet database in my database by using regsql tool. i create users and roles in it all working is well. I use my laptop for creating application and my system name is Zulfiqar_PC.I have two different user accounts on my system
I have done all my working in Zulfiqar user account while working with website administration tool. and it works fine but now when i want to run my application from second user that is administrator then it doesnot return me the data and give me error that "Login failed for user 'Zulfiqar-PC\Administrator'."
my connectionstring is same in both accounts in web.config file here is my connectionstring and other settings of database
<add connectionString="data source=(local); Initial Catalog=BA; User ID=sa;Password=sql123" name="dbconnection" providerName="System.Data.SqlClient" /> <providers> <clear/> <remove name="AspNetSqlMembershipProvider" /> <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider,
System.Web, Version=126.96.36.199, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="dbconnection" applicationName="/" /> </providers> </membership> <profile> <providers> <clear /> <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="dbconnection" applicationName="/" /> </providers> </profile> <roleManager enabled="true"> <providers> <clear /> <add connectionStringName="dbconnection" applicationName="/" name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" /> <add applicationName="/" name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" /> </providers> </roleManager>
When i run the website administration tool in administaror account its user name is as under Current User Name:ZULFIQAR-PC\ADMINISTRATOR
and in first account it is as under Current User Name:ZULFIQAR-PC\Zulfiqar
Plz any one help me what i do to resolve this problem I already enabled sql tcp/ip ports etc.
Try 2 Following Different Methods.
Please change database file / SQL Connection string to other like following any declarations
<add connectionString="data source=( CHANGE HERE TO DATABASE PATH ); Initial Catalog=BA; User ID=sa;Password=sql123" name="dbconnection" providerName="System.Data.SqlClient" />
CHANGE PATH TO : DATA SOURCE PATH LIKE
"Datasource="C:\PROJECT\MYDATABASE.mdb"" \\ Project Database
use this sql serve datasource Tag
<add name="cs" connectionString="server=localhost;User Id=root;database=db_hrms"/>
The Project (Web application in VS C#) that you created is present in
C:\Users\User_Name_1\Documents\Visual Studio 2010\Projects C:\Users\User_Name_2\Documents\Visual Studio 2010\Projects
you must copy the project and run it with different User (other user) both Produces same results for web application but it differs in windows application. But the data base you are connecting to doesn't exists in other user.
I solved my problem by creating administrtor account and assign this account proper server roles in sql server. I does not had administrator account in sql server.