Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Generating a Windown generated username/password dialog box

Posted on 2005-04-04
Medium Priority
Last Modified: 2010-04-07
Is their a way to create a Windows generated username / password dialog box in asp .net?

This is how I have it in regualr asp....

Dim userId

userID = Request.ServerVariables("LOGON_USER")

If (userID = "") Then
   Response.Status = "401 access denied"
   Response.Write("<B>You do not have access to this page.</B>")
%><!-- Comment out redirection code
<meta http-equiv="REFRESH" content="0; URL=default.asp"> </head> <body bgcolor="white"> </body> </html>

End If
<body >
The userID is <%= userID%>

......but when I try this in .net, sessionvariables("logon_user") is blank
Question by:shuittny
  • 3
LVL 23

Accepted Solution

b1xml2 earned 2000 total points
ID: 13699388
IIS Settings
1. Open the Internet Information Services under Adminstrative Tools
2. Select The WebApplication and select "Properties"
3. Select the "Directory Security" Tab
4. Click on the Edit button inside the "Anonymous access and authentication control"
5. De-select "Anonymous access"
6. Select "Integrated Windows Authentication"
7. Click OK

.NET Settings
1. Open web.config file
2. Ensure the following:

<authentication mode="Windows" />

under this, add the following:

<identity impersonate="true" />
3. Inside ASP.NET, to access the User,

Author Comment

ID: 13699519
keep the original code the same on top of all of that
LVL 23

Expert Comment

ID: 13699532
ASP is not the same as ASP.NET. <EOM>
LVL 23

Expert Comment

ID: 13699692
<%@ Page Language="vb" %>
<script language="vb" runat="server">
Sub Page_Load(ByVal sender As Object,ByVal e As EventArgs)
LiteralUserName.Text = User.Identity.Name
If Not User.IsInRole(@"<server>\<group>") Then
      Response.StatusCode = 401
      Response.StatusDescription = "401 Access Denied"
End If
End Sub
The userId Is <asp:Literal Id="LiteralUserName" runat="server" />

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Kernel Data Recovery is a renowned Data Recovery solution provider which offers wide range of softwares for both enterprise and home users with its cost-effective solutions. Let's have a quick overview of the journey and data recovery tools range he…
How can you see what you are working on when you want to see it while you to save a copy? Add a "Save As" icon to the Quick Access Toolbar, or QAT. That way, when you save a copy of a query, form, report, or other object you are modifying, you…
Suggested Courses

579 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question