var _user = document.getElementById("username").value; '<%Session["UserName"] = "'+ _user +' "; %>'
string my = Session["UserName"].ToString();
Session
JavaScript
Sessions
WebMethod
[System.Web.Services.WebMethod] public static void SetUserName(string userName) { Page objPage = new Page(); objPage.Session["UserName"] = userName; }
aspx
ScriptManager
Pagemethods
<asp:ScriptManager EnablePageMethods="true" ID="ScriptManager" runat="server" ScriptMode="Release" LoadScriptsBeforeUI="true"></asp:ScriptManager>
var _user = document.getElementById("username").value; PageMethods.SetUserName(_user);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)