Click here to Skip to main content
15,913,388 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
HTML Code is following
XML
<!-- start login box here -->
<div class="fr">
<div class="loginbox">
<div class="loginboxbg">
<div class="ltop">
<div class="bleft">
<div class="bright">
<div style="padding: 5px 10px; height: 20px;" class="arial15"> <strong>MEMBERS
LOGIN</strong> </div>
<div style="padding: 5px 10px;">
<form action="http://208.101.14.59/sms/php/pass.php?go=login"
 method="post" name="form" id="form">
  <div>
  <div class="fl" style="width: 155px;">Login Email:</div>
  <div class="fl" style="width: 20px;">&nbsp;</div>
  <div class="fl" style="width: 106px;">Password :</div>
  <div class="clear">&nbsp;</div>
  </div>
  <div>
  <div class="fl" style="width: 155px;"><input class="box1" name="email"
 type="text"></div>
  <div class="fl" style="width: 20px;">&nbsp;</div>
  <div class="fl" style="width: 106px;"> <input class="box2" name="pwd"
 type="password"></div>
  <div class="fl"> <input src="images/loginbutt.jpg"
 onclick="getElementById('form').submit()" type="image"> </div>
  <div class="clear">&nbsp;</div>
  </div>
</form>
</div>
<div>&nbsp;</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- End login box here -->

I want to convert this code in .Net but it is giving some error.
Please help me.
Posted
Updated 13-Sep-10 0:25am
v2
Comments
Sandeep Mewara 13-Sep-10 6:25am    
What error?

1 solution

Hi Vinodkumar,


I have modified code as per your requirement:

This is HTML code
XML
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ZTest2.aspx.cs" Inherits="ZTest2" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
    <script language="javascript" type="text/javascript">
        alert('Invalid Email or Password!');
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div class="fr">
        <div class="loginbox">
            <div class="loginboxbg">
                <div class="ltop">
                    <div class="bleft">
                        <div class="bright">
                            <div style="padding: 5px 10px; height: 20px;" class="arial15">
                                <strong>MEMBERS LOGIN</strong>
                            </div>
                            <div style="padding: 5px 10px;">
                                <form action="http://208.101.14.59/sms/php/pass.php?go=login" method="post" name="form"
                                id="form">
                                <div>
                                    <div class="fl" style="width: 155px;">
                                        Login Email:</div>
                                    <div class="fl" style="width: 20px;">
                                    </div>
                                    <div class="fl" style="width: 106px;">
                                        Password :</div>
                                    <div class="clear">
                                    </div>
                                </div>
                                <div>
                                    <div class="fl" style="width: 155px;">
                                        <asp:TextBox runat="server" ID="txtEmail" CssClass="box1"></asp:TextBox>
                                    </div>
                                    <div class="fl" style="width: 20px;">
                                    </div>
                                    <div class="fl" style="width: 106px;">
                                        <asp:TextBox runat="server" ID="txtPassword" CssClass="box2" TextMode="Password"></asp:TextBox>
                                    </div>
                                    <div class="fl">
                                        <asp:ImageButton runat="server" ID="ibtnLogin" ImageUrl="mages/loginbutt.jpg"
                                            AlternateText="Click to login" onclick="ibtnLogin_Click" />
                                    </div>
                                    <div class="clear">
                                    </div>
                                </div>
                                </form>
                            </div>
                            <div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    </form>
</body>
</html>


This is server side code
C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class ZTest2 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
    }
    protected void ibtnLogin_Click(object sender, ImageClickEventArgs e)
    {
        //Write your logic here...
        //suppose in database would have
        //Email=Imdadhusen.sunasara@gmail.com
        //Password=Imdad
        if (txtEmail.Text == "Imdadhusen.sunasara@gmail.com" && txtPassword.Text == "Imdad")
        {
            //Valid Email and Password
            //You can write page name here instead of ProductHome.aspx
            Response.Redirect("ProductHome.aspx");
        }
        else
        {
            //Invalid Email or Password
            string strMessage =  @" <script language='javascript' type='text/javascript'>
                                    alert('Invalid Email or Password!');
                                    </script>";
            Response.Write(strMessage);
        }
    }
}



Please do let me know, if you have any doubt.

Please provide Vote if this would be helpful to you.

Thanks,
Imdadhusen
 
Share this answer
 
v2
Comments
VinodKumar01 13-Sep-10 23:42pm    
sir this page also have three asp:textbox control and one asp:buttion control for quick enquiry but when we click on login buttion it redirect again on this same page with out showing any error plese help me

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900