protected void Button1_Click(object sender, EventArgs e) { String URL = "Page2.aspx"; HttpContext.Current.Response.AddHeader("USER", "admin"); Response.Redirect(URL); }
protected void Page_Load(object sender, EventArgs e) { try { if (!IsPostBack) { if (HttpContext.Current.Request.Headers.Get("USER") != null) { string tUserName = Convert.ToString(HttpContext.Current.Request.Headers.Get("USER")); if (tUserName != null || tUserName.ToString() != "") { Label1.Text = tUserName; } } Label2.Text = HttpContext.Current.Request.Headers.Get("X-AspNet-Version"); } } catch (Exception ex) { throw ex; } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)