ASP.NET Get Windows User

I

intractably

You can protect your pages via something like:

if( User.Identity.Name != "DOMAIN\\username")
Response.Redirect("page.aspx?qid=" + qid);

You will also have to configure IIS to use Basic or Windows
authentication
and deny access to anonymous users on the ASPX page:

1. Start, Control Panel, Administrative Tools, Internet Information
Services
2. Right-click on your web application and select Properties.
3. On the Directory Security tab, select Edit for Anonymous access and
authentication control.
4. Disable Anonymous access and enable Basic authentication and/or
Integrated Windows authentication.

Otherwise, if you use anonymous access, User.Identity.Name will always
show up as "".
 

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

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,132
Latest member
TeresaWcq1
Top