Wednesday, March 21, 2012
login failed for user -- why?
I run the website for now on my machine, IIS config for the site is no anonymous access, Integrated Windows security only, but it doesn't seem to matter what I use.
We had to change from using a common user id/pw to Integrated security. I run the app in VS2003 studio, and try to connect with this code and string:
WebConfig:
<add key="connectionString" value="Data Source=chchtdev02;Initial Catalog=InsourceMaster;Integrated Security=SSPI" />
cs file:
SqlConnection myConn = new SqlConnection(connStr);
myConn.Open();
The group 'Development Global' of which I am a member has been added to the System Administrator role on the SQL 7 installation on the new server.
I've even added my own network logon alone and tried to use the string
<add key="connectionString" value="Data Source=chchtdev02;Initial Catalog=InsourceMaster;user id=myusername;password=mypassword />
causing basically the same error. Both are included below.
Anyone have any ideas what I'm missing here?
Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.
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: Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.
Source Error:
Line 229: int i;
Line 230: SqlConnection myConn = new SqlConnection(connStr);
Line 231: myConn.Open();
Line 232: SqlCommand cmd = new SqlCommand();
Line 233: cmd.Connection = myConn;
Source File: c:\inetpub\wwwroot\xmlinsourceedit\xmlinsourceedit .aspx.cs Line: 231
Stack Trace:
[SqlException: Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.]
System.Data.SqlClient.ConnectionPool.GetConnection (Boolean& isInTransaction)
System.Data.SqlClient.SqlConnectionPoolManager.Get PooledConnection(SqlConnectionString options, Boolean& isInTransaction)
System.Data.SqlClient.SqlConnection.Open()
XMLInsourceEdit.XMLInsourceEdit.FillDropDownsFromS ql(String gStatecode, String gBookcode, String gTypecode) in c:\inetpub\wwwroot\xmlinsourceedit\xmlinsourceedit .aspx.cs:231
XMLInsourceEdit.XMLInsourceEdit.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\xmlinsourceedit\xmlinsourceedit .aspx.cs:151
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()
Login failed for user 'myusername'.
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: Login failed for user 'myusername'.
Source Error:
Line 229: int i;
Line 230: SqlConnection myConn = new SqlConnection(connStr);
Line 231: myConn.Open();
Line 232: SqlCommand cmd = new SqlCommand();
Line 233: cmd.Connection = myConn;
Source File: c:\inetpub\wwwroot\xmlinsourceedit\xmlinsourceedit .aspx.cs Line: 231
Stack Trace:
[SqlException: Login failed for user 'myusername'.]
System.Data.SqlClient.ConnectionPool.GetConnection (Boolean& isInTransaction)
System.Data.SqlClient.SqlConnectionPoolManager.Get PooledConnection(SqlConnectionString options, Boolean& isInTransaction)
System.Data.SqlClient.SqlConnection.Open()
XMLInsourceEdit.XMLInsourceEdit.FillDropDownsFromS ql(String gStatecode, String gBookcode, String gTypecode) in c:\inetpub\wwwroot\xmlinsourceedit\xmlinsourceedit .aspx.cs:231
XMLInsourceEdit.XMLInsourceEdit.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\xmlinsourceedit\xmlinsourceedit .aspx.cs:151
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()I'm still taking my first tentative steps with ASP.NET, so I may be off base here; still, I'll take a stab because I think I ran into something similar recently.
ASP.NET runs under the context of the (localmachine)\ASPNET user account. You will need to add this user to the SQL Logins (sp_grantaccess)in order to use integrated security. If you're SQL server is not local, then you will need to add (localmachine)\ASPNET into a Domain Group and add the Domain Group into SQL Logins.
I know that you indicated that you were running the website with windows authentication. I did the same thing, but for some reason it would not accept my credentials (that was another issue that took some time to resolve).
Also, check out www.connectionstrings.com. They had some good information on connecting with the ASP.NET SQLClient object. I think I had to type the keywords that they gave exactly as given (case sensitive) in order to get anywhere. I realize that doesn't sound right, but it is what worked for me finally.
That's part of the reason I have been so hesitant with ASP.NET; it seems in so many respect to be foreign to me. Sigh, I guess I'm getting too old to learn new tricks.
Good Luck,
hmscott
Monday, March 19, 2012
Login Failed - XP Home Edtion accessing SQL Server
I have an application (VB 6) that access a database in a SQL Server.
But, I cant access the database when I try to run the application using
XP Home Edtion, even logging in domain (by "map network drives).
I can access the shares in SQL server normally, but when I run the
application appears the error window attached.
Any idea?
Tks in advance
Dan Pinhiero
Rio de Janeiro - Brasil
You might try the connection string below ('User Id' omitted):
"Provider=SQLOLEDB;Data Source=SERV_MT207\DROGASM1;Initial
Catalog=master;Integrated Security=SSPI;Application
Name=CallCenter;Pooling=True"
Hope this helps.
Dan Guzman
SQL Server MVP
"Dan Pinheiro" <dan_pinheirorj@.hotmail.com> wrote in message
news:uqOKXEWHEHA.3820@.tk2msftngp13.phx.gbl...
> Hi All.
> I have an application (VB 6) that access a database in a SQL Server.
> But, I cant access the database when I try to run the application using
> XP Home Edtion, even logging in domain (by "map network drives).
> I can access the shares in SQL server normally, but when I run the
> application appears the error window attached.
> Any idea?
> Tks in advance
> Dan Pinhiero
> Rio de Janeiro - Brasil
>
|||Dan Guzman escreveu:
> You might try the connection string below ('User Id' omitted):
> "Provider=SQLOLEDB;Data Source=SERV_MT207\DROGASM1;Initial
> Catalog=master;Integrated Security=SSPI;Application
> Name=CallCenter;Pooling=True"
>
Hi Dan, thanks for your help, but the application needs the "user id",
due permissions settings. Is there some way to bypass this problem
changing the role/security settings?
Best Regards
Dan Pinheiro
Rio de Janeiro - Brasil.
|||If you want to connect using standard SQL Security, you can specify both
UserId and Password in the connection string and omit the Integrated
Security keyword. Your server will need to be configured to allow both
Windows and SQL authentication.
Hope this helps.
Dan Guzman
SQL Server MVP
"Dan Pinheiro" <dan_pinheirorj@.hotmail.com> wrote in message
news:exOROLXHEHA.3144@.TK2MSFTNGP10.phx.gbl...
> Dan Guzman escreveu:
>
> Hi Dan, thanks for your help, but the application needs the "user id",
> due permissions settings. Is there some way to bypass this problem
> changing the role/security settings?
> Best Regards
> Dan Pinheiro
> Rio de Janeiro - Brasil.
>
Login Failed - XP Home Edtion accessing SQL Server
I have an application (VB 6) that access a database in a SQL Server.
But, I cant access the database when I try to run the application using
XP Home Edtion, even logging in domain (by "map network drives).
I can access the shares in SQL server normally, but when I run the
application appears the error window attached.
Any idea?
Tks in advance
Dan Pinhiero
Rio de Janeiro - BrasilYou might try the connection string below ('User Id' omitted):
"Provider=SQLOLEDB;Data Source=SERV_MT207\DROGASM1;Initial
Catalog=master;Integrated Security=SSPI;Application
Name=CallCenter;Pooling=True"
Hope this helps.
Dan Guzman
SQL Server MVP
"Dan Pinheiro" <dan_pinheirorj@.hotmail.com> wrote in message
news:uqOKXEWHEHA.3820@.tk2msftngp13.phx.gbl...
> Hi All.
> I have an application (VB 6) that access a database in a SQL Server.
> But, I cant access the database when I try to run the application using
> XP Home Edtion, even logging in domain (by "map network drives).
> I can access the shares in SQL server normally, but when I run the
> application appears the error window attached.
> Any idea?
> Tks in advance
> Dan Pinhiero
> Rio de Janeiro - Brasil
>
----
--|||Dan Guzman escreveu:
> You might try the connection string below ('User Id' omitted):
> "Provider=SQLOLEDB;Data Source=SERV_MT207\DROGASM1;Initial
> Catalog=master;Integrated Security=SSPI;Application
> Name=CallCenter;Pooling=True"
>
Hi Dan, thanks for your help, but the application needs the "user id",
due permissions settings. Is there some way to bypass this problem
changing the role/security settings?
Best Regards
Dan Pinheiro
Rio de Janeiro - Brasil.|||If you want to connect using standard SQL Security, you can specify both
UserId and Password in the connection string and omit the Integrated
Security keyword. Your server will need to be configured to allow both
Windows and SQL authentication.
Hope this helps.
Dan Guzman
SQL Server MVP
"Dan Pinheiro" <dan_pinheirorj@.hotmail.com> wrote in message
news:exOROLXHEHA.3144@.TK2MSFTNGP10.phx.gbl...
> Dan Guzman escreveu:
>
> Hi Dan, thanks for your help, but the application needs the "user id",
> due permissions settings. Is there some way to bypass this problem
> changing the role/security settings?
> Best Regards
> Dan Pinheiro
> Rio de Janeiro - Brasil.
>
Login Failed - Accessing through XP Home Edition
I have an application (VB 6) that access a database in a SQL Server.
But, I cant access the database when I try to run the application using
XP Home Edtion, even logging in domain (by "map network drives).
I can access the shares in SQL server normally, but when I run the
application appears the error window attached.
Any idea?
Tks in advance
Dan Pinhiero
Rio de Janeiro - Brasil
The null in "login failed for user null" indicates that the domain
controller didn't send a valid, authenticated windows login to SQL Server.
There may be a problem with the DC (out of date, permissions, etc.) or with
something on the network. From the XP workstation you need to see if you
can get to other network resources on the domain without having to enter
credentials and fix it if you can't. You can also see what logonserver (DC)
that workstation is pointed to (run SET from a cmd prompt) and see if you
can point it to a different DC.
Cindy Gross, MCDBA, MCSE
http://cindygross.tripod.com
This posting is provided "AS IS" with no warranties, and confers no rights.
Friday, February 24, 2012
logging who did what
I want to be able to log who did what on which table. I need to display this information on the web application. Is there an easy way of doing this, rather that making duplicates of a lot of data?
The best way I have thought of so far is making a new table with the following fields:
Table_Changed
Table_Primary_Key
Old_Field_Value
New_Field_Value
User
Date_Changed
Every time someone changes something, it is logged in this table, so that, at any time, I can display who changed what.
I have one more question. If I do do it this way, is there a way of getting the primary key value of any table? E.G. could I do something like this_table.primary_key.value ?
JagsYou may try to use "Trigger" to do this.|||Thank you for the help, but I am not actually worried about how I am going to do it (I was thinking of using triggers anyway).
I am more worried about whether the method I am using will work nicely, or will the table I create become so large that it will slow the server down too much.|||I guess how large the table gets will depend on how many updates your site will do each day. One option to get around this is to archive the data at set intervals. For instance, setup a sql server job once a month to copy all the data from the production server's logging table onto a 2nd servers logging table. This table would reside on a server that doesn't matter as much how fast it is running as the backup would happen in the middle of the night or some other time of inactivity.