コード例 #1
0
ファイル: Admin.aspx.cs プロジェクト: kamalpathi/Demo1
        protected void btnSubmit_ServerClick(object sender, EventArgs e)
        {
            try
            {
                UserAuthentication _userAuthentication = new UserAuthentication();
                string VenueID;
                bool retval = _userAuthentication.AdminLogin(UserNm.Value, tpassword.Value, out VenueID);
                if (retval == true)
                {
                    Session["SVenue"] = VenueID;
                    Session["UNM"] = UserNm.Value;
            //                    Response.Redirect("~/mainpage.aspx");
                            Response.Redirect("~/mainpage.aspx", false);
                            Context.ApplicationInstance.CompleteRequest();

                }
                else
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "User Authentication", "<script type='text/javascript'>ConfirmMsg('Invalid Username or password.','User Authentication');</script>", false);
                }
            }
            catch (Exception ex)
            {
                ErrHandler.WriteError(ex.Message);
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Error", "javascript:alert('Server is busy.Please try after sometime.');", true);
            }
        }
コード例 #2
0
ファイル: events-List.aspx.cs プロジェクト: kamalpathi/Demo1
        protected void FormSubmit_ServerClick(object sender, EventArgs e)
        {
            try
            {
                if (hdType.Value == "SendPassword")
                {
                    SendEmailProcess _sendProcess = new SendEmailProcess();
                    string body = string.Empty;

                    using (StreamReader reader = new StreamReader(Server.MapPath("~/EmailFormat.html")))
                    {
                        body = reader.ReadToEnd();
                    }

                    string retval = "";
                    string retvalEx = _sendProcess.SendEmail(txtEmail.Value.Trim(), body, out retval);
                    UserAuthentication _userauth = new UserAuthentication();
                    bool retvalAuth = _userauth.UpdateUserPassword(txtEmail.Value.Trim(), retval);

                    if (retvalAuth == true)
                    {
                        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "Login", "<script type='text/javascript'>Msg('Password send.','User Registration');</script>", false);
                    }
                    hdType.Value = "SignIn";

                }
                else if (IsValdateLoginUser() == true)
                {
                    if (hdType.Value == "SignIn")
                    {
                        AuthenticateAndTicket();
                    }
                    else if (hdType.Value == "Register")
                    {
                        if (CreateUser() == true)
                        {
                            AuthenticateAndTicket();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ErrHandler.WriteError(ex.Message);
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Error", "javascript:alert('Server is busy.Please try after sometime.');", true);
            }
        }