Click here to Skip to main content
13,632,131 members
Rate this:
 
Please Sign up or sign in to vote.
See more:
I am working on Asp.net with the c# project. Here I have a requirement, Open the same window with multiple pages with multiple Sessions.

Example:

1) MainPage.aspx which is Parent window. Which have multiple orders.

2) ChildPage.aspx which is child window

The customer can open different machines by selecting different orders. So always open a ChildPage.aspxpage with different data(Order values).

So, for these requirements which method I should use and Why?

What I have tried:

I tried using Sessions, which is not working for me.
Posted 13-Jul-18 0:36am
Updated 2 days ago
Comments
F-ES Sitecore 13-Jul-18 6:42am
   
I don't really understand the question, but you can't control session management from your code so you can't force them to use multiple sessions, or even the same session...that all depends on how the user's browser handles cookies.

So if sessions don't work then use querystrings, it's a no-brainer. Only thing to bear in mind if that the querystring can be manipulated by the user so if this is sensitive data make sure the person asking for the data has the rights to see it.
Bojjaiah 13-Jul-18 6:52am
   
The customer can open the ChildPage.aspx page after selecting any of records. Again customer can open ChildPage.aspx page by selecting another record from MainPage.aspx. Here ChildPage.aspx are multiple windows for every request. In this case, the session will not work, right? So, how can we handle in this situation?
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Use view states / hidden fields.

ASP.NET View State Overview[^]
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

You use the session or View state

For view state use:
Understanding ASP.NET View State[^] this link follow
Viewstate is use in only one page

For session use:
ASP.NET Session State Overview[^]
session is use server side and client side
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

You use the session or View state

More suitable for Your Question in use to View state.

For view state use:
Understanding ASP.NET View State[^] this link follow
Viewstate is use in only one page

For session use:
ASP.NET Session State Overview[^]
session is use server side and client side
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 4

Hi,

Even tought you can achive your goal with one way or another, here is what and how i think you should use sessions and queryStrings.

1/ QuerySTrings
-I always use queryString to redirect to details pages.
In your case childWindow.aspx?id=5.
As long the data you pass is not important (no password and other critical data)
=> thats why you must have an id column in your database tables, so you can get your data with your unique ids.
2/Session:
Session can make the code very hard to mantain, so its better to avoid them and only use them when needed.
3/ViewStates
View states are basicaly sessions but not in all of the application level but in the page level.
They are very usefull in postbacks.
Here is an exemple :
private MyClass ClassObject
        {
            get { return ViewState["myClassObj"] as MyClass ; }
            set { ViewState["myClassObj"] = value; }
        }

You can imagine this as an init, when a post back is performed, you can always access your ClassObject because we saved it.

PS : Pay attention, with this method any user can change the value in the url and access data they dont have the right to, so :
-You should implement a role management system to avoid this.
-Probably wise to encrypt/decrypt your queryStrings.

Hope it helps.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Cookies | Terms of Service
Web02-2016 | 2.8.180712.1 | Last Updated 18 Jul 2018
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100