jQuery Funcation

JQuery Login
http://www.aspdotnet-pools.com/2014/09/ajax-login-form-using-jquery-in-aspnet.html
JQuery logout
==================================================================================================
http://stackoverflow.com/questions/11700463/logout-in-mvc-using-session-without-javascript-jquery
————————————————————————————————–
@{
ViewBag.Title = “LogOut”;
Layout = “~/Views/Shared/_Layout.cshtml”;
}

LogOut

public ActionResult LogOut()
{
FormsAuthentication.SignOut();
return RedirectToAction(“Index”, “Home”);
}
===============================================================================
Logout

public ViewResult Logout()
{
Session.Abandon();
return View(“Index”, “Home”);
}
================================================================================
Rememberme
================================================================================
protected void Page_Load(object sender, EventArgs e)
{
if (Request.Cookies[“Remember”] != null)
{
HttpCookie cookieRemember = Request.Cookies.Get(“Remember”);
txtEmail.Text = cookieRemember.Values[“Email”];
txtPassword.Text = cookieRemember.Values[“Password”];
Response.Cookies[“Remember”].Expires = DateTime.Now;
}
}
protected void btnLogin_Click(object sender, EventArgs e)
{
bool result = VerifyAccount(txtEmail.Text, txtPassword.Text);

if (result == true)
{
if (ChkRemember.Checked)
{
HttpCookie cookieRemember = new HttpCookie(“Remember”);
cookieRemember.Values.Add(“Email”, txtEmail.Text);
cookieRemember.Values.Add(“Password”, txtPassword.Text);
cookieRemember.Expires = DateTime.Now.AddDays(10);
Response.Cookies.Add(cookieRemember);
}
Response.Redirect(“UserPage.aspx”);
}
else
{
lblMessage.Text = “Sorry you cannot login, please provide correct Email and password”;
}
}
=======================================================================================
forget password
http://www.itorian.com/2013/03/PasswordResetting.html

http://www.code-sample.com/2014/08/forgot-password-in-mvc-5-aspnet.html
=======================================================================================
//Count character lenght of message
=================================================================================


(Minimum 100 characters)

Query function

$(‘#characterLeft’).text(‘500 characters left’);
$(‘#AreatxtMessage’).keyup(function () {
var min= 100;
var max = 500;
var len = $(this).val().length;
if (len >= max) {
$(‘#characterLeft’).text(‘ you have reached the limit’);
} else {
var ch = max – len;

$(‘#characterLeft’).text(ch + ‘ characters left’);
}
});

css class

.RemLab {margin-left:660px;}

================================================================================================================
SaveImage jquery
===============================================================================================================
function SaveImage(input) {

var fileUpload1 = $(input).get(0);
var files1 = fileUpload1.files;
if (files1.length > 0) {

//var files1 = fileUpload1.files;
var D_Name1 = fileUpload1.files[0].name;
if ((D_Name1 != null) || (D_Name1 != “”)) {
var FileExtension1 = checkFileExtension(D_Name1);
if (FileExtension1 == ‘png’ || FileExtension1 == ‘jpg’ || FileExtension1 == ‘jpeg’) {
var data1 = new FormData();
for (var i = 0; i < files1.length; i++) {
data1.append(files1[i].name, files1[i]);
}
$.ajax({
type: 'POST',
processData: false,
contentType: false,
cache: true,
data: data1,
async: false,
url: "/Content/Handler/UploadImage.ashx?files=" + D_Name1,
success: function (response) {
debugger
if (response == null) {
return false;
}
else {

var a = "/Content/Upload/FullSizeUserImage/" + response;
$('#abc').attr('src', a);
$('#imguserprofile').attr('src', a);
SaveImageName(response);

}
}
});
}
else {
alert(FileExtension1 + ' File type is not supported');
return false;
}
}
==============================================================================================
hrf link
==============================================================================================
// window.location.href = 'http://&#039; + window.location.host + '/LegalDocument/Index';
// url: 'http://&#039; + window.location.host + '/LegalDocument/Logoutmethod',
// window.location.href = Url.Action("ContactUs", "LegalDocument");
//Url.Action("ContactUs", "LegalDocument")
//url: '@System.Configuration.ConfigurationManager.AppSettings["PageURL"]' + LegalDocument / Index;
//
//window.location.href = “http://localhost:51507/LegalDocument/Index&#8221;;

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s