Solved

Need to authetication for three credentials

Posted on 2009-07-13
7
234 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

863 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

26 Experts available now in Live!

Get 1:1 Help Now