467,174 Members | 1,388 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,174 developers. It's quick & easy.

security...

RAB
I have created a folder which I named 'Security' with the path
....Inetpub/wwwroot/Security

Within the 'Security' folder, I have placed three files. Web.config,
default.aspx and login.aspx

The three folders have the following code:

' web.config
<configuration>
<system.web>
<customErrors mode="Off"/>
<authentication mode="Forms">
<forms name="appNameAuth" path="/" loginUrl="login.aspx"
protection="All" timeout="30">
<credentials passwordFormat="Clear">
<user name="jeff" password="test" />
<user name="mike" password="test" />
</credentials>
</forms>
</authentication>
<authorization>
<deny users="?" />
</authorization>
</system.web>
</configuration>
' default.aspx
<%@Page Language="VB" %>
<%@Import Namespace="System.Web.Security" %>
<script language="VB" runat="server">
Sub ProcessLogin(objSender As Object, objArgs As EventArgs)

If FormsAuthentication.Authenticate(txtUser.Text, txtPassword.Text)
Then
FormsAuthentication.RedirectFromLoginPage(txtUser. Text,
chkPersistLogin.Checked)
Else
ErrorMessage.InnerHtml = "<b>Something went wrong...</b> please
re-enter your credentials..."
End If

End Sub
</script>
<html>
<head>
<title>Standard Forms Authentication Login Form</title>
</head>

<body bgcolor="#FFFFFF" text="#000000">
<form runat="server">
<table width="400" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="80">Username : </td>
<td width="10"> </td>
<td><asp:TextBox Id="txtUser" width="150" runat="server"/></td>
</tr>
<tr>
<td>Password : </td>
<td width="10"> </td>
<td><asp:TextBox Id="txtPassword" width="150" TextMode="Password"
runat="server"/></td>
</tr>
<tr>
<tr>
<td></td>
<td width="10"> </td>
<td><asp:CheckBox id="chkPersistLogin" runat="server" />Remember my
credentials<br>
</td>
</tr>
<tr>
<td> </td>
<td width="10"> </td>
<td><asp:Button Id="cmdLogin" OnClick="ProcessLogin" Text="Login"
runat="server" /></td>
</tr>
</table>
<br>
<br>
<div id="ErrorMessage" runat="server" />
</form>
</body>
</html>
'login.aspx
<%@Page Language="VB" %>
<%@Import Namespace="System.Web.Security" %>
<script language="vb" runat="server">
Sub SignOut(objSender As Object, objArgs As EventArgs)
'delete the users auth cookie and sign out
FormsAuthentication.SignOut()
'redirect the user to their referring page
Response.Redirect(Request.UrlReferrer.ToString())
End Sub
Sub Page_Load()
'verify authentication
If User.Identity.IsAuthenticated Then
'display Credential information
displayCredentials.InnerHtml = "Current User : <b>" &
User.Identity.Name & "</b>" & _
"<br><br>Authentication Used : <b>" &
User.Identity.AuthenticationType & "</b>"
Else
'Display Error Message
displayCredentials.InnerHtml = "Sorry, you have not been
authenticated."
End If
End Sub
</script>
<html>
<head>
<title>Forms Authentication</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<span class="Header">Forms Based Authentication using standard
method</span>
<br>
<br>
<div id="displayCredentials" runat="server" />
<br>
<br>
<form runat="server">
<asp:Button id="cmdSignOut" text="Sign Out" runat="server"
onClick="SignOut" />
</form>
</body>
</html>

I can open default.aspx just fine. My problem is when I put in the
appropriate user name and password into the textboxes I am directed to
an error page that says "cannot open .../Security/login.aspx"

I went to IIS and made the security folder an application, but I am not
sure if i did it right.

Any help would be appreciated?

Thanks,
RABMissouri

Jun 11 '06 #1
  • viewed: 856
Share:

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by robert | last post: by
116 posts views Thread by Mike MacSween | last post: by
4 posts views Thread by Ashish | last post: by
reply views Thread by prithvi g via .NET 247 | last post: by
7 posts views Thread by Magdelin | last post: by
3 posts views Thread by Velvet | last post: by
1 post views Thread by Jeremy S. | last post: by
2 posts views Thread by Budhi Saputra Prasetya | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.