Created
February 8, 2018 06:33
-
-
Save Abhinay-g/ef4705f0e235a6258672335f5a3e1c17 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Query String : | |
while redirecting from controller we can pass Query string as follows: | |
return Redirect("/Customer/CustomerHome?username=" + username); | |
Now to use Query String on respective page use below code | |
<h4>Welcome @Request.QueryString["username"]</h4> | |
** Now if you want that this Username is displayed over all pages using "Session" is a better Idea | |
Use Session variable in controller as follows | |
Session["username"] = username; | |
To use this session variable on all page | |
<div class="col-md-3">Welcome @Session["username"]</div> | |
Better way include this session variable in _layout file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment