Solved

Need to authetication for three credentials

Posted on 2009-07-13
7
236 Views
Last Modified: 2012-05-07
I want to put something in the behind code to validate the username and password and email
if all are ok then take them to another page.
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="EmailSystem._Default" %>

<%@ Register Src="~/Controls/ctrlCopyright.ascx" TagPrefix="BaseWebmail" TagName="Copyright" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="Content-Script-Type" content="text/javascript" />
    <meta http-equiv="Cache-Control" content="private,max-age=1209600" />
    <title>Koretelematics Email System</title>
    <link rel="stylesheet" href="skins/Hotmail_Style/styles.css" type="text/css" id="skin" />

 

    <script language="javascript" type="text/javascript">
// <!CDATA[

        function email_onclick() {

        }

        function login_onclick() {

        }

        function password_onclick() {

        }

// ]]>
    </script>
</head>
<body>
    <div align="center">
             <form id="Form1" method="post" runat="server">
             <div class="wm_login" align="center">
            <div class="a">
            </div>
            <div class="b">
            </div>
            <div class="login_table" style="margin: 0px;">
                <div class="wm_login_header">Login Information</div>
                <table id="login_table" border="0" cellspacing="0" cellpadding="10">
                    <tr id="email_cont" <%=emailClass%>>
                        <td class="wm_title" style="font-size: 12px; width: 70px;">
                            Email:
                        </td>
                        <td>
                            <input style="width: 99%; font-size: 16px;" class="wm_input" type="text" value=""
                                id="email" name="email" maxlength="255" onfocus="this.className = 'wm_input_focus';"
                                onblur="this.className = 'wm_input';" onclick="return email_onclick()" />
                        </td>
                    </tr>
                    <tr id="login_cont" <%=loginClass%>>
                        <td class="wm_title" style="font-size: 12px; width: 70px;">
                            Login:
                        </td>
                        <td id="login_parent">
                            <nobr>
                                                <input style="width: <%=loginWidth%>; font-size: 16px;" class="wm_input" type="text" value="" id="login" name="login" maxlength="255"
                                                      onfocus="this.className = 'wm_input_focus';" onblur="this.className = 'wm_input';" onclick="return login_onclick()" />
                                                <span id="domain"><%=domainContent%></span>
                                          </nobr>
                        </td>
                    </tr>
                    <tr>
                        <td class="wm_title" style="font-size: 12px; width: 70px;">
                            Password:
                        </td>
                        <td>
                            <input style="width: 99%; font-size: 16px;" class="wm_input wm_password_input" type="password"
                                value="" id="password" name="password" maxlength="255" onfocus="this.className = 'wm_input_focus wm_password_input';"
                                onblur="this.className = 'wm_input wm_password_input';" onclick="return password_onclick()" />
                        </td>
                    </tr>
                    <tr>
                        <td class="wm_title" style="font-size: 12px; width: 70px;">
                            &nbsp;</td>
                        <td>
                        <span class="wm_login_button">
                            <asp:Button class="wm_button" runat="server" id="submit" text="Login"
                                onclick="submit_Click"/></span></td>
                    </tr>
                </table>
            </div>
            <div class="b">
            </div>
            <div class="a">
            </div>
            </div>
        </form>
    </div>
    <BaseWebmail:Copyright ID="Control_Copyright" runat="server"></BaseWebmail:Copyright>
</body>
</html>
0
Comment
Question by:mathieu_cupryk
  • 4
  • 3
7 Comments
 
LVL 19

Expert Comment

by:daveamour
ID: 24847126
Validate against what - a database. Active Directory?
0
 

Author Comment

by:mathieu_cupryk
ID: 24850441
webconfig will be fine.

I just want one user for testing.
0
 
LVL 19

Expert Comment

by:daveamour
ID: 24856795
You mean you want to store the username, password and email address in the web.config and validate against that?  And you just want to do this for one user?
0
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 

Author Comment

by:mathieu_cupryk
ID: 24856828
yes
0
 
LVL 19

Accepted Solution

by:
daveamour earned 500 total points
ID: 24856857
Ok well first of all you need to make your text boxes server controls:
<asp:TextBox
Then in your web.config have something like:

<appSettings>
      <add key="username" value="dave" />
      <add key="password" value="test" />
      <add key="email" value="dave@test.com" />
</appSettings>
Then  in code behind have something like this:

protected void submit_Click(object sender, EventArgs e)
{
      string username = ConfigurationManager.AppSettings["username"];
      string email = ConfigurationManager.AppSettings["email"];
      string password = ConfigurationManager.AppSettings["password"];
      //Validate here - eg if (logon.Text == username && .....
}
0
 

Author Comment

by:mathieu_cupryk
ID: 24869782
cool what should I put for the following:
<authentication mode="Forms" />
            
            <authorization>
                  <allow users="*" />
            </authorization>
0
 

Author Closing Comment

by:mathieu_cupryk
ID: 31602977
excellent
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

774 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