Link to home
Start Free TrialLog in
Avatar of Seven price
Seven priceFlag for United States of America

asked on

iframe request parent page querystring

Parent.Page.Request.QueryString("In")

Hello, I tried the above to retrieve the parent page querystring but I get an error.
 System.NullReferenceException: Object reference not set to an instance of an object.

in vb how can I retrieve the querystring value to pass to my parameter?

Avatar of HainKurt
HainKurt
Flag of Canada image

just use

Request.QueryString("In")

or simply:

Request("In")


Avatar of Seven price

ASKER

You did not read the entire question i suppose,
The page is in a iframe but I need the query string from the parent page the iframe lives.
do you mean this?

page.aspx has an iframe inside, say name=myFrame, src=frame.aspx

you call page.aspx?in=HK and somehow you post the myFrame and in the code frame.aspx.vb you want to get the in parameter of page.aspx?

if this is the case, you should create a hidden variable in frame.aspx and set it to "in" param before submitting it on client side, either with js or when you construct the src attribute of frame

like

<iframe src='frame.aspx?in=<%=request("in") %>' ...>
or use session...

on page.aspx.vb page_load event

session("in")=request("in")

then use session("in") in frame.aspx.vb
I tried a session but i thought there was another way on the server side.
ASKER CERTIFIED SOLUTION
Avatar of HainKurt
HainKurt
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ts