Re: Building SQL connection string in code-behind file. Works on my machine, not on server.






You always need to know and be aware of the account you're running under:

Here is some crappy debugging code.

I think the issue is you don't have sql server credentials for the user the
program is running under.

Go to Control Panel / Users and you can see a list of "built in" users that
a windows machine has.



private string FindIIdentity()

{

try

{



string returnValue = string.Empty;

WindowsIdentity ident = WindowsIdentity.GetCurrent();

returnValue = ident.Name;

try

{

returnValue += " on " + System.Environment.MachineName;

}

catch (Exception ex)

{

}

return returnValue;

}



catch (Exception ex)

{

return "Error Finding Identity";

}

}






"Brett" <brettlf@xxxxxxxxxxxxxxxx> wrote in message
news:OfvJ1Nb8IHA.4608@xxxxxxxxxxxxxxxxxxxxxxx
I wrote an ASP.NET application that queries a SQL Server database (on a
different box from the web server) and displays the result in a GridView.
The datasource for the GridView is a SQLDataSource. Just to get it to
work, I hard-coded the username and password of a SQL Server account in the
connectionstring in web.config. Once I confirmed that this worked on the
web server, I wanted to remove the hard-coded password from web.config, so
I removed that portion of the connectionstring. In the Page_Load procedure
of the page's code-behind file, I then appended the username and password
to the connectionstring in web.config. It worked perfectly on my machine
in Visual Studio.NET 2008. So, I moved the updated code to the web server,
but I got the error, "Login failed for user 'NT AUTHORITY\ANONYMOUS
LOGON'." What is the problem here?



Thanks for any help you can provide.



Brett




.



Relevant Pages

  • RE: How to enable IWA over multiple servers
    ... Boot up computer and logon as ActiveDirectory username (im joe ... a member of 192.168.0.4 (the web server), ... through a local account on the webserver rather than a domain user ... Microsoft MSDN Online Support Lead ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • RE: How to enable IWA over multiple servers
    ... Boot up computer and logon as ActiveDirectory username (im joe ... a member of 192.168.0.4 (the web server), ... client domain identity correctly when the ASP.NET app is hosted on ... through a local account on the webserver rather than a domain user ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • RE: How to enable IWA over multiple servers
    ... Developing More Secure Microsoft ASP.NET 2.0 Applications ... how are you accessing the web server? ... Boot up computer and logon as ActiveDirectory username (im joe ... are you logon through a local account on the webserver rather ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: Working on a Web Server 2003
    ... I'm not trying to install the web server on a DC. ... > Are you trying to setup and secure a webserver on a DC? ... > A built in account that has a high level of access rights ... Network Service: ...
    (microsoft.public.inetserver.iis)
  • Re: Working on a Web Server 2003
    ... I'm not trying to install the web server on a DC. ... > Are you trying to setup and secure a webserver on a DC? ... > A built in account that has a high level of access rights ... Network Service: ...
    (microsoft.public.windows.server.active_directory)