G
Guest
I am making a ASP.NET application that connects to a database.
I want to distribute this to my customers that may have different Windows
OS, so my installer must handle different windows versions.
The installer makes sure SQL Server 2005 is there, IIS is ready and ASP.NET
is set up properly.
In my installer I am using the following SQL statement to enable ASP.NET to
connect to my database.
CREATE LOGIN [NT AUTHORITY\NETWORK SERVICE] FROM WINDOWS
followed by
sp_grantdbaccess 'NT AUTHORITY\NETWORK SERVICE'
This works like a charm when the ASP.NET user is NT AUTHORITY\NETWORK
SERVICE, but that is not the case for all Windows versions.
It even depends on the language of the windows operation system.
Example: I tried it on a Swedish Windows 2003 Server, and then the user was
"NT INSTANS\NETWORK SERVICE"
Again, on other machines, the user is "machinename\ASPNET"
How do I detect (in C#) the name (including domain) of the user that runs
the ASP.NET process?
Thankful for any response
I want to distribute this to my customers that may have different Windows
OS, so my installer must handle different windows versions.
The installer makes sure SQL Server 2005 is there, IIS is ready and ASP.NET
is set up properly.
In my installer I am using the following SQL statement to enable ASP.NET to
connect to my database.
CREATE LOGIN [NT AUTHORITY\NETWORK SERVICE] FROM WINDOWS
followed by
sp_grantdbaccess 'NT AUTHORITY\NETWORK SERVICE'
This works like a charm when the ASP.NET user is NT AUTHORITY\NETWORK
SERVICE, but that is not the case for all Windows versions.
It even depends on the language of the windows operation system.
Example: I tried it on a Swedish Windows 2003 Server, and then the user was
"NT INSTANS\NETWORK SERVICE"
Again, on other machines, the user is "machinename\ASPNET"
How do I detect (in C#) the name (including domain) of the user that runs
the ASP.NET process?
Thankful for any response