I want to pass session value from aspx page to .html page
i have one aspx page and 1 .html page i want to pass session value of aspx page to textbox of html page.. how can i do that can anyone send me code
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Francis SusaimichaelRank #466 · 5.4K reputationPosted Sep 29, 2015, 3:27 AM EDT
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="DemoWebForm.WebForm1" %>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Session["MySession"] = "MySessionVariable";
Response.Redirect(String.Concat("HtmlPage.html?myval=", Convert.ToString(Session["MySession"])));
}
}
}
Upendra Pratap ShahiRank #329 · 7.5K reputationPosted Sep 29, 2015, 1:04 AM EDT
Manas MohapatraRank #182 · 13.2K reputationPosted Sep 29, 2015, 1:10 AM EDT
Monica Bundel100 reputationPosted Sep 29, 2015, 10:05 PM EDT
Francis SusaimichaelRank #466 · 5.4K reputationPosted Sep 30, 2015, 1:47 AM EDT
Monica Bundel100 reputationPosted Oct 1, 2015, 12:40 AM EDT
Francis SusaimichaelRank #466 · 5.4K reputationPosted Oct 1, 2015, 1:46 AM EDT
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Login.aspx.cs" Inherits="DemoWebForm.Login" %>
Login.aspx.cs
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace DemoWebForm
{
public partial class Login : System.Web.UI.Page
{
protected void btnLogin_Click(object sender, EventArgs e)
{
// Store the user name
Session["UserName"] = txtUserName.Text;
Response.Redirect(String.Concat("HtmlPage.html?uname=", Convert.ToString(Session["UserName"])));
}
}
}
Monica Bundel100 reputationPosted Oct 2, 2015, 8:23 PM EDT
Francis SusaimichaelRank #466 · 5.4K reputationPosted Oct 4, 2015, 9:38 PM EDT