Query String, Session State

Posted by Amatya under C# on 5/9/2015 | Points: 10 | Views : 479 | Status : [Member] | Replies : 2
When to use Query String and Session Variable, when i want to store the value of the variable and use it in another page of ASP?

Feel free to share informations 9731764134
mail Id ' adityagupta200@gmail.com
Thanks



Responses

Posted by: Allemahesh on: 5/11/2015 [Member] [MVP] Silver | Points: 25

Up
0
Down
Hi,

You can use the query string to pass the values form one page to another page. You can use query string in any page like .html, .aspx, .cshtml (MVC).

You will use the session variable to maintain the value thought the pages.

For example, you want to pass the data table object form one page to another page, in that case you can’t use the query string. So one solution may be you can use the session for this.

Another example, if you want to access the values through JavaScript or JQuery in other page, in that case use the query string and no the session.

Happy Coding...

If this response is usefull,
Please click on "Mark This Response As Answer" .

Thanks
Mahesh Alle


Amatya, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Shreedar on: 8/16/2015 [Member] Starter | Points: 25

Up
0
Down
To pass simple data from one page to other page we can use query string.
Query String is appended at the end of url.
Query String has limitations.
1.Some browser support length of url 256 characters only.
2.Query string data is visible to user.

Session variable is used to maintain user log. If session time outs then user automatically gets logout.

Regards,
Sridhar Thota.

Regards

Sridhar Thota.
www.dotnet-sridhar.blogspot.com

Amatya, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response