iframe request parent page querystring


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?

Seven priceFull StackAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

HainKurtConnect With a Mentor Sr. System AnalystCommented:
on the server you cannot get the parent page of browser :)

somehow you should pass that parameter to the server when iframe src is requested (either adding id to url or setting a cookie or setting a hidden variable and post it) or use session...

in your case simplest way is set a session whenever you have that param and use it later when you need...
HainKurtSr. System AnalystCommented:
just use


or simply:


Seven priceFull StackAuthor Commented:
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.
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

HainKurtSr. System AnalystCommented:
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


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

on page.aspx.vb page_load event


then use session("in") in frame.aspx.vb
Seven priceFull StackAuthor Commented:
I tried a session but i thought there was another way on the server side.
Seven priceFull StackAuthor Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.