ASPForums.Net RSS Feed additions to the content that appears on ASPForums.Net(c) 2019 All rights reserved.Send (Pass) Session value from View to Controller in ASP.Net MVC<p>Hi&nbsp;mahesh213,</p> <p>Session is used to store data on the server. It allows a controller to pass data to another controller.</p> <p>If you want to change a session value with jQuery, you must make an ajax call to an action that updates session.</p> <p>You can access the Session value in Controller without passing it through Ajax request.</p> <pre class="brush: csharp">public JsonResult getAll() { int Id = Convert.ToInt32(Session[&#34;EId&#34;]); db.Configuration.ProxyCreationEnabled = false; using (ReportEntities dataContext = new ReportEntities()) { var employeeList = (from E in dataContext.MenuSelection1 where E.EId == Id orderby E.Id select new { E.Id, E.ControllerName, E.Url }).ToList(); var JsonResult = Json(employeeList, JsonRequestBehavior.AllowGet); JsonResult.MaxJsonLength = int.MaxValue; return JsonResult; } }</pre> <p>And remove the parameter from Ajax call.</p>, 17 Jul 2019 02:15:32 GMT