Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Need to authetication for three credentials

Posted on 2009-07-13
7
Medium Priority
?
258 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:mathieu_cupryk
ID: 24856828
yes
0
 
LVL 19

Accepted Solution

by:
daveamour earned 2000 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

636 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