Solved

Need to authetication for three credentials

Posted on 2009-07-13
7
231 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
This video discusses moving either the default database or any database to a new volume.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

743 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now