views:

174

answers:

2

I am currently in C# and I have set Session variables on each page.

The link to my Colorbox is in the MasterPage, and on click opens up in> an iframe from a different page in a different folder

i.e. /admin/deals.aspx <-- iframed page in colorbox which needs SESSION /default.aspx <-- page with set SESSION

Is there a way I can pass this variable to the iframed page?

A: 

I'm not really sure what you're asking - but let's just wing it;

Session variables are sessionwide and globally accessible, so when you've set the Session variable before opening your "colorbox" you should have access to that Session and therefor the enclosed variable.

On a sidenote however; do you really want to be using iFrames? (and Sessionvars for that matter).

riffnl
Colorbox is a jQuery plugin that (amongst other things) can open an iFrame as an in-line modal window. So, in this instance, iFrames are "legitimate". See http://colorpowered.com/colorbox/core/example5/index.html
Dan Diplo
You're using the "Outside Webpage" example from the colorbox? -- are you refering to a page within your solution or redirect to an outside page? Could you provide a piece of samplecode?
riffnl
Thanks guys I figured it out. I was accidentally canceling out the Session x.x
Bry4n
A: 

Session is relative to the user and site, not the page, so there is no reason why deal.aspx cannot access the Session variable set by default.aspx.

Alternatively, you could just pass the value on the querystring to the iframe. I am not a fan of this though as it means the user can tamper with the variable. Instead what i like to do is generate a random key (guids are good for this), use that as the Session key to store the variable, and then pass the key through on the querystring - still not foolproof, but it obfuscates things (the user cannot tamper with the variable value), and it prevents hardcoding of any keys in to your source code (as different pages need to know the same Session key).

slugster