|
-
Jun 23rd, 2005, 09:13 AM
#1
Thread Starter
Addicted Member
get username from visitor ?
Hello,
I'm looking for a way to get the username from the visitor from my webapplication. Any idea how to do that?
I use following code but it only works on my local developing machine:
Code:
Dim strUser As String
strUser = Request.LogonUserIdentity.Name.ToString()
Me.txtPersoon.Text = strUser.Substring(strUser.IndexOf("\") + 1)
tnx
nickname
Software Engineer
DBA
Webdesigner
--
to code or to be coded, that's the question
-
Jun 23rd, 2005, 09:21 AM
#2
Re: get username from visitor ?
Disable anonymous access to your virtual directory. Use windows authentication instead. You can set this in Directory security in IIS.
-
Jun 23rd, 2005, 09:40 AM
#3
Thread Starter
Addicted Member
Re: get username from visitor ?
 Originally Posted by mendhak
Disable anonymous access to your virtual directory. Use windows authentication instead. You can set this in Directory security in IIS.
disabled anonymous access + enabled windows authentication but now the webappl. asks for user and password :-S
Software Engineer
DBA
Webdesigner
--
to code or to be coded, that's the question
-
Jun 24th, 2005, 01:41 AM
#4
Re: get username from visitor ?
Yes it does. That's what you want, isn't it?
-
Jun 24th, 2005, 01:54 AM
#5
Thread Starter
Addicted Member
Re: get username from visitor ?
 Originally Posted by mendhak
Yes it does. That's what you want, isn't it?
No, let me explain..
I made a webapplication where the users of my network can reservate a room. And one of the fields they have to fill in is their username. Now, in my network everyone is logged in with there username, so I want to get that username and fill it in that txt automatic.
so Me.txtUsername.Text = ....???... 'filled in automaticly
Why want I to fill it in automaticly? Because else they can reservate a room on someone else his/her username..
Hope you understand now what I want.
greetz
nickname
Software Engineer
DBA
Webdesigner
--
to code or to be coded, that's the question
-
Jun 24th, 2005, 04:27 AM
#6
Re: get username from visitor ?
Yes, I understood. But in order for your app to be able to access the username, you would need to use Windows authentication. The steps I've outlined above are what you need.
-
Jun 24th, 2005, 04:31 AM
#7
Thread Starter
Addicted Member
Re: get username from visitor ?
 Originally Posted by mendhak
Yes, I understood. But in order for your app to be able to access the username, you would need to use Windows authentication. The steps I've outlined above are what you need.
So it isn't possible without letting the visitors type their username and password? Like I said above? The problem is I would like it go automatic
greetz
nickname
Software Engineer
DBA
Webdesigner
--
to code or to be coded, that's the question
-
Jun 24th, 2005, 05:02 AM
#8
Re: get username from visitor ?
You can try to create your own login mechanism, but that'd involve a start page where the users login with their credentials.
Else this is the way it goes!
-
Jul 7th, 2005, 07:07 AM
#9
Re: get username from visitor ?
I'm using Windows Authentication, and I would like to query the client's login ID for a log file. How do I grab the login? Request.LogonUserIdentity.Name.ToString does not work for me, is there something I need to include?
-
Jul 7th, 2005, 12:52 PM
#10
Frenzied Member
Re: get username from visitor ?
System.Enviorment.User......
Magiaus
If I helped give me some points.
-
Jul 7th, 2005, 02:52 PM
#11
Re: get username from visitor ?
I'm using System.Environment.UserDomainName System.Environment.UserName
DomainName returns the Server's name, and UserName returns ASPNET
-
Jul 8th, 2005, 07:07 AM
#12
Frenzied Member
Re: get username from visitor ?
Then they are not logged in as network user and you should consider just building your own user login system or using forms authin.... Mendhak has actualy used form autin so he could tell you more than I can on that front.
If they are logging in at all now you could consider putting the login data in a session var. When I build a custom login I usually make a lite weight LoginInfo class and keep it in a session var.
Example properties are User, Password, AllowedAccess and NumberOfLoginAttempts.
Magiaus
If I helped give me some points.
-
Jul 8th, 2005, 02:08 PM
#13
Re: get username from visitor ?
System.Web.HttpContext.Current.User.Identity.Name will return the visitor's login name (if Windows authentication is enabled), else the default impersonation user identity (MACHINE\ASPNET)
-
Jul 8th, 2005, 02:40 PM
#14
Re: get username from visitor ?
Just what I was looking for! Thanks!!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|