?
Solved

Generating a Windown generated username/password dialog box

Posted on 2005-04-04
4
Medium Priority
?
196 Views
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
<html>
<head>
<meta http-equiv="REFRESH" content="0; URL=default.asp"> </head> <body bgcolor="white"> </body> </html>
--><%

   Response.End
End If
%>
<html>
<body >
The userID is <%= userID%>
</body>
</html>


......but when I try this in .net, sessionvariables("logon_user") is blank
0
Comment
Question by:shuittny
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 23

Accepted Solution

by:
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,
Response.Write(User.Identity.Name)
0
 

Author Comment

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

Expert Comment

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

Expert Comment

by:b1xml2
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"
      Response.Write(Response.StatusDescription)
End If
End Sub
</script>
<html>
<body>
The userId Is <asp:Literal Id="LiteralUserName" runat="server" />
</body>
</html>
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

777 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