Hi,

I need some help for my project. I had finished up my login page and I can be logined.

The problem is that I want to allow new users to register themsevles before they can login but I have used various way I can't be directed to the Register.aspx because web.config. Is there anyway to redirect?

I had attached the following codes:

Web.config:

<configuration>
<appSettings>
<add key="localhost.DisplayString" value="http://localhost:1032/Webservices1/Service.asmx"/>
</appSettings>
<system.web>
<authentication mode="Forms">
<forms name=".IT3732Login" loginUrl="Login.aspx" protection="All" timeout="60"/>
</authentication>
<machineKey validationKey="AutoGenerate" decryptionKey="AutoGenerate" validation="SHA1"/>
<authorization>
<deny users="?"/>
</authorization>
<compilation debug="true"/>
</system.web>
</configuration>

Login.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Login.aspx.cs" Inherits="Login" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script Language="c#" runat="server">
private void CheckLogin(object sender, EventArgs e)
{
 
localhost.Service ds = new localhost.Service();
if (ds.Check(TextBox2.Text, txtPassword.Text) == "OK")
{
FormsAuthentication.RedirectFromLoginPage(TextBox2.Text, false);
string Usname = (string)Session["Username"];
Usname = TextBox2.Text;
Session["Username"] = Usname;
}
else
{
lblMSG.Text = "Login Fail. Please try again.";
TextBox2.Text = "";
txtPassword.Text = "";
TextBox2.Focus();
}
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Coca-Cola - Login</title>
</head>
<body bgcolor="#cc0000">
<form id="form1" runat="server">
<div style="text-align: center">
<span style="font-size: 16pt; color: white">= = = = = = = = = = = = = = = = = =<br />
= = =The Coca-Cola Company = = =<br />
= = = = = = = = = = = = = = = = = =</span><br />
<br />
<span style="color: white; font-size: 14pt;">= = = = = = =<br />
--
LOGIN --<br />
= = = = = = =</span><br />
</div>
User ID:
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBox2"
ErrorMessage="User ID is required" ForeColor="White"></asp:RequiredFieldValidator><br />
<br />
Password:
<asp:TextBox ID="txtPassword" runat="server" TextMode="Password"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtPassword"
ErrorMessage="Password is required" ForeColor="White"></asp:RequiredFieldValidator><br />
<br />
<asp:Button ID="btnLogin" runat="server" BackColor="White" Text="Login" Width="104px" OnClick="CheckLogin" />
<asp:Button ID="btnBack" runat="server" BackColor="White" OnClick="btnBack_Click"
Text="Back" Width="104px" />
<br />
<br />
<a href="Register.aspx" target="_blank"><span style="font-size: 14pt; color: #ffffff">
Register!</span></a><span style="font-size: 14pt; color: #ffffff"> </span>
<br />
<br />
<asp:Label ID="lblMSG" runat="server" Height="30px" Width="212px"></asp:Label>
</form>
</body>
</html>

http://img.photobucket.com/albums/v76/blu3crush/Login.jpg --print sceen of my login.aspx

How to implement multitheading in 'C'

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.