Login page help

Please support our C# advertiser: Intel Parallel Studio Home
Reply

Join Date: May 2006
Posts: 4
Reputation: karkar_87 is an unknown quantity at this point 
Solved Threads: 0
karkar_87 karkar_87 is offline Offline
Newbie Poster

Re: Simple ASP.Net Login Page using C#

 
0
  #1
Jul 25th, 2006
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:

  1.  
  2. <configuration>
  3. <appSettings>
  4. <add key="localhost.DisplayString" value="http://localhost:1032/Webservices1/Service.asmx"/>
  5. </appSettings>
  6. <system.web>
  7. <authentication mode="Forms">
  8. <forms name=".IT3732Login" loginUrl="Login.aspx" protection="All" timeout="60"/>
  9. </authentication>
  10. <machineKey validationKey="AutoGenerate" decryptionKey="AutoGenerate" validation="SHA1"/>
  11. <authorization>
  12. <deny users="?"/>
  13. </authorization>
  14. <compilation debug="true"/>
  15. </system.web>
  16. </configuration>

Login.aspx

  1.  
  2. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Login.aspx.cs" Inherits="Login" %>
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4. <script Language="c#" runat="server">
  5. private void CheckLogin(object sender, EventArgs e)
  6. {
  7.  
  8. localhost.Service ds = new localhost.Service();
  9. if (ds.Check(TextBox2.Text, txtPassword.Text) == "OK")
  10. {
  11. FormsAuthentication.RedirectFromLoginPage(TextBox2.Text, false);
  12. string Usname = (string)Session["Username"];
  13. Usname = TextBox2.Text;
  14. Session["Username"] = Usname;
  15. }
  16. else
  17. {
  18. lblMSG.Text = "Login Fail. Please try again.";
  19. TextBox2.Text = "";
  20. txtPassword.Text = "";
  21. TextBox2.Focus();
  22. }
  23. }
  24. </script>
  25. <html xmlns="http://www.w3.org/1999/xhtml" >
  26. <head runat="server">
  27. <title>Coca-Cola - Login</title>
  28. </head>
  29. <body bgcolor="#cc0000">
  30. <form id="form1" runat="server">
  31. <div style="text-align: center">
  32. <span style="font-size: 16pt; color: white">= = = = = = = = = = = = = = = = = =<br />
  33. = = =The Coca-Cola Company = = =<br />
  34. = = = = = = = = = = = = = = = = = =</span><br />
  35. <br />
  36. <span style="color: white; font-size: 14pt;">= = = = = = =<br />
  37. --
  38. LOGIN --<br />
  39. = = = = = = =</span><br />
  40. </div>
  41. User ID:
  42. <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
  43. <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBox2"
  44. ErrorMessage="User ID is required" ForeColor="White"></asp:RequiredFieldValidator><br />
  45. <br />
  46. Password:
  47. <asp:TextBox ID="txtPassword" runat="server" TextMode="Password"></asp:TextBox>
  48. <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtPassword"
  49. ErrorMessage="Password is required" ForeColor="White"></asp:RequiredFieldValidator><br />
  50. <br />
  51. <asp:Button ID="btnLogin" runat="server" BackColor="White" Text="Login" Width="104px" OnClick="CheckLogin" />
  52. <asp:Button ID="btnBack" runat="server" BackColor="White" OnClick="btnBack_Click"
  53. Text="Back" Width="104px" />
  54. <br />
  55. <br />
  56. <a href="Register.aspx" target="_blank"><span style="font-size: 14pt; color: #ffffff">
  57. Register!</span></a><span style="font-size: 14pt; color: #ffffff"> </span>
  58. <br />
  59. <br />
  60. <asp:Label ID="lblMSG" runat="server" Height="30px" Width="212px"></asp:Label>
  61. </form>
  62. </body>
  63. </html>

http://img.photobucket.com/albums/v7...rush/Login.jpg --print sceen of my login.aspx
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 2
Reputation: gurudatta.verma is an unknown quantity at this point 
Solved Threads: 0
gurudatta.verma gurudatta.verma is offline Offline
Newbie Poster

Re: Login page help

 
0
  #2
Aug 2nd, 2006
How to implement multitheading in 'C'
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for C#
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC