user name in database!

R

rcoco

Hi,
I'm wondering how to do this, I'm working on the on a datagrid and I'm
using windows authentication. I managed to get username on to a login
form, but I want it to be stored into the database.The code of web
config looks like:
authentication mode="Windows"
identity impersonate="true"
And the Login page looks like on(Page_load):
Response.Write(Page.User.Identity.Name);
Thanks.
 
R

rcoco

Thanks David,
This is actually what I wanted. But I was wondering if you could
actually change this code into c#.I'm not familiar with VB.

Dim username As String
username = User.Identity.Name
Dim User As System.Security.Principal.IPrincipal
User = System.Web.HttpContext.Current.User
Dim username As String
username = User.Identity.Name

Thanks.
 
M

Mike Hofer

Thanks David,
This is actually what I wanted. But I was wondering if you could
actually change this code into c#.I'm not familiar with VB.

Dim username As String
username = User.Identity.Name
Dim User As System.Security.Principal.IPrincipal
User = System.Web.HttpContext.Current.User
Dim username As String
username = User.Identity.Name

Thanks.

String username = User.Identity.Name;
System.Security.Principal.IPrincipal User =
System.Web.HttpContext.Current.User;
String userName = User.Identity.Name;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,217
Latest member
topweb3twitterchannels

Latest Threads

Top