title: How to persist a value in asp.net label after response.redirect to same URL
body: <p>I have an application which is used by another application by passing credentials in <code>querystring</code> to my application.I will take the <code>querystring</code> and do the LDAP authentication .If it is failed , i will move to my application login page to enter credentials after clearing querystrings(<code>Response.Redirect(Request.RawUrl.Replace(Request.Url.Query, ""), false);</code>) from URL.But here i have to show a message to user like invalid NT credentials.I assigned the message to Session variable and then assigned to a asp.net label,but it is not working ie no warningmessage coming.
  This is the code i did</p>
  
  <pre><code>if (AutheticateLDAP("LDAP://dc01-opsoft.corp.ae", txtUserName.Value, txtPassword.Value))
          {
  
          }
          else
          {
              Session["val"] = "Invalid credentials,Use NT  UserId and Password";
              if (!string.IsNullOrEmpty(Request.Url.Query))
              {
                  txtUserName.Attributes.Remove("readonly");
                  txtPassword.Attributes.Remove("readonly");
                  Response.Redirect(Request.RawUrl.Replace(Request.Url.Query, ""), false);
              }
              lblMsg.Text = Session["val"].ToString();
              return;
          }
  </code></pre>
  
  <p>Here when i debug i can see that values are properly assigned to <code>lblMsg.Text</code>,but finally it disappears in UI</p>