You must Sign In to post a response.
  • Category: ASP.NET

    Querystring, or session which is best option?

    I have created one form.In that form I am taking input from user. Onclick event of button I want show record in grid in other window(Different page).I want to pass user input to other page.There are 12 user input.Which is best option?
    1>Querystring: pass 12 parameter and hide address bar
    2>execute sp on same page and store datatable in session.So other page will receive it.

    What is max length of querystring and max size of session?
  • #751216
    Hello pinky,

    You should go with session for more security and reliability.
    You have number of parameters to pass in another page so it is more feasible to use session instead of query string.
    Query string is more faster than session but it is less secure than session.
    Query string mac values depends on various browsers type like below.

    IE 4.0 and above is : 2048 characters
    IE. 4,5,6,7, : 2,048 characters.
    Opera supports : 4050 characters.
    Netscape 6 supports : 2000 characters.
    Firefox Supports : 6000 characters

    You should search in google regarding that for more information and resources.

    Regards,
    Nirav Prabtani (Senior Web Developer)
    Email : niravjprabtani@gmail.com
    blog : niravprabtani.blogspot.in

  • #751217
    Thanks Nirav Prabtani for ur help...

  • #751218
    Hi Pinky, As per my knowledge yes there is limitation on querystring when you are using it and its depends upon browsers, it will vary to browsers. But using a session as data table is easy approach but the thing in that is you needs to have a good configured server machine especially if you have high traffic site are something then it may crash your speed of the application. Since there is no size limitation on session variables.

    For more information :

    http://www.dotnetspider.com/forum/187858-What-is-the-Max-size-of-the-Session-in-aspnet.aspx

    and for different type of statemanagement refer below link:
    http://www.dotnetspider.com/resources/44056-What-ASP.NET-State-Management.aspx

    Rajesh B
    To Live More,Learn More

  • #751228
    Hi,

    you can use any one of those but querystring accept 2048 characters. So, if you want to manage user details alone then query string is the best option, if you want to encrypt the details using encrypt algorithms you can encrypt it at the same time if you want to pass bulk of data or huge data then you go with session, session will occupy any type of data like primitive type as well as complex type but query string accepts only primitive type of data only.

    --------------------------------------------------------------------------------
    Give respect to your work, Instead of trying to impress your boss.

    N@veen
    Blog : http://naveens-dotnet.blogspot.in/

  • #751271
    There is a limitation on the Query string size and the data is always exposed to the end user if they are not encrypted.

    In the other hand session has a very good storage option where from string to object you can store any thing.

    The session is also available through out the application.

    Thanks & Regards
    Anil Kumar Pandey
    Microsoft MVP, DNS MVM

  • #751372
    Hi,

    I think Query string is a very good option when you are dealing with the small size. It has the capacity up to accept 2048 characters. So if your size is limited to this, query string is a very good option as its very simple too.
    But if you are dealing with the large data and you want to use some security settings also, session is a better option.
    Also one thing we should consider before using any of them is session is much secure then query string but it has the issue of slow speed.
    So now depending on your need select the one which suits your requirement.

    Hope this will help you !!

    Thanks,
    Ashutosh Jha
    http://tricksroad.com


  • Sign In to post your comments