Hi guys,

I am in the process of creating a login form in ASP.Net and I have not written any code for it yet bcos I dont know how to go about doing it.In the past I have created basic login forms in ASP.net by redirecting them to a page if the login was successful or display them a failed message in a label control if it was a invalid login. Now Im thinking of

  • Displaying the failed message in a jQuery modal popup
  • In the same popup provide a textbox control asking them to put their email address and a button to send an email to the admin asking for their password,then display a message in a label control saying the email has been sent to the admin.

If anyone knows of any tutorials or articles explaining how to do this ,please let me know.Im also googling for steps to execute this.

Thank You

Recommended Answers

All 2 Replies

Hi guys,

I am in the process of creating a login form in ASP.Net and I have not written any code for it yet bcos I dont know how to go about doing it.In the past I have created basic login forms in ASP.net by redirecting them to a page if the login was successful or display them a failed message in a label control if it was a invalid login. Now Im thinking of

  • Displaying the failed message in a jQuery modal popup
  • In the same popup provide a textbox control asking them to put their email address and a button to send an email to the admin asking for their password,then display a message in a label control saying the email has been sent to the admin.

If anyone knows of any tutorials or articles explaining how to do this ,please let me know.Im also googling for steps to execute this.

Thank You

Hi, once I made the mail control lab. JavaScript checks the textboxes for being fulfilled, emailbox for being valid... If some of them is not, then borders of boxes getting red and explanation marks appearing. This form can be easily rewritten in jQuery. If you are interested, write me an email and I'll send you this lab.

<script type = "text/javascript">

function checkauthen() {

    $.ajax({

        type: "POST",

        url: "CS.aspx/CheckUserName",

        data: '{userName: "' + $("#<%=txtUserName.ClientID%>")[0].value + '" }',

        contentType: "application/json; charset=utf-8",

        dataType: "json",

        success: OnSuccess,

        failure: function(response) {

            alert(response);

        }

    });

}

function OnSuccess(response) {



    switch (response.d) {

        case "true":



            href.location=querySt( window.location.toString());

            break;

        case "false":



            href.location = "notlogin.aspx";

            break;

        case "error":


            href.location = "error.aspx";

            break;                    

    }

}

function querySt(ji) {
hu = window.location.search.substring(1);
gy = hu.split("&");
for (i=0;i<gy.length;i++) {
ft = gy[i].split("=");
if (ft[0] == ji) {
return ft[1];
}
}

</script>

[System.Web.Services.WebMethod]

public static string CheckUserName(string userName,string password)

{

    string returnValue = string.Empty;

    try

    {

        string consString = ConfigurationManager

                .ConnectionStrings["conString"].ConnectionString;

        SqlConnection conn = new SqlConnection(consString);

        SqlCommand cmd = new SqlCommand("CheckUser", conn);           

        cmd.CommandType = CommandType.StoredProcedure;


        cmd.Parameters.AddWithValue("@UserName", userName.Trim());

        cmd.Parameters.AddWithValue("@password", password.Trim());

        conn.Open();

        returnValue = cmd.ExecuteScalar().ToString();

        conn.Close();

    }

    catch

    {

        returnValue = "error";

    }

    return returnValue;

}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.