Solved

Need to authetication for three credentials

Posted on 2009-07-13
7
239 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
Industry Leaders: 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 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

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

Suggested Solutions

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

733 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