473,508 Members | 2,202 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Getting Local System's UserName in a web based project

NawazAhmed
36 New Member
Hi,
I was trying to get local system's username in my code behind. I tried every almost possible way.
Here is the scenario:
My project is web based and I don't have a login screen....I need to get the local system's username when some user opens the website....
I tried.
Expand|Select|Wrap|Line Numbers
  1. environment.Username
  2. environ("username")
  3. System.Windows.Forms.SystemInformation.UserName
  4. system.Security.Principal.WindowsIdentity.GetCurrent.Name
  5.  
and some functions as well posted at this site: http://www.developerfusion.co.uk/show/4409/
But no luck.....Its getting the username from the server instead of the user's computer.....
And I am using VS 2008.
I would really appriciate....If someone can provide me a better solution for this..

Thanks.
Aug 19 '08 #1
6 2105
Curtis Rutland
3,256 Recognized Expert Specialist
Well, if you are using integrated windows authentication in IIS, this will get the domain user name:
Expand|Select|Wrap|Line Numbers
  1. Page.User.Identity.Name
  2.  
But if you allow Anonymous access, you might just get the IUSR_<machinename> account. I'm not sure what happens if you use Basic/Forms authentication.
Aug 19 '08 #2
NawazAhmed
36 New Member
How can I turn on windows authentication in vista ultimate?

I found this it was under programs and turn windows features on or off..
Aug 19 '08 #3
Curtis Rutland
3,256 Recognized Expert Specialist
I'm not sure of your whole setup. Windows authentication works against a domain.

You need to understand more about IIS authentication. Look that up. Vista uses IIS 7.
Aug 19 '08 #4
NawazAhmed
36 New Member
Hey I turned on the windows authentication and ran the same thing again...
but I am not getting any username....
Any guesses...what could b the problem???
Aug 19 '08 #5
Curtis Rutland
3,256 Recognized Expert Specialist
Like I said, Windows authentication works against a domain. You aren't going to be able to get just anyone's local username, because you don't have access to it through the web. You need to either set up a domain, or use basic authentication. But basic authentication still refers to accounts on the server, not the client.
Aug 19 '08 #6
NawazAhmed
36 New Member
I atlast got this one working..........
I went to server and turned on windows authentication in IIS and turned off the asyncronous option.......and thats all I need to do to get the clients username and no doubt client should be in the same domain.

Thanks for the help guyz.
Aug 21 '08 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

1
2283
by: Simon Harvey | last post by:
Hi chaps, I've made a pretty simple service in c# using VS.net. It compiles correctly and I've followed what little documentation there is to create a setup project in order to install the...
6
2903
by: Rob | last post by:
Hi, I am working on a project that requires a Windows Service which performs the following file transfer functions. 1. It monitors a specific local directory on a Windows 2003 Server. 2. When...
0
3694
by: ruju00 | last post by:
I am getting an error in Login() method of the following class FtpConnection public class FtpConnection { public class FtpException : Exception { public FtpException(string message) :...
5
20110
by: ljlevend2 | last post by:
Is there any way to create a local server during runtime? For example, if you add an existing Web Site to a Solution from within Visual Studio (by right clicking the solution in the Solution...
6
2784
by: WT | last post by:
Hello, Using VS2005. I have an assembly library that can be called from a Web site asp.net application or from a winform application. From this library I need to retrieve a path using simply a...
33
11809
by: JamesB | last post by:
I am writing a service that monitors when a particular app is started. Works, but I need to get the user who is currently logged in, and of course Environment.UserName returns the service logon...
2
2092
by: Chris Marsh | last post by:
Hi all I have one machine (A) which is not on a domain. There is an local user account on A (userA) that has access to a certain folder. I have another machine (B). An application on B...
1
887
by: Just_a_fan | last post by:
I can sign in manually in the help system or in a browser but then when I try to get a help from a forum entry via the help system, it tells me I cannot sign in or the site is broken and throws up...
8
12533
by: tiijnar | last post by:
Hi, To get windows username Im using the following code. public class GetWindowUsername { public String getUser() { String userName = System.getProperty("user.name");...
0
7127
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7331
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7391
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7501
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5633
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4713
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3188
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1564
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
424
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.