Avatar of cdemott33
cdemott33
Flag for United States of America asked on

How do I pass a QueryString value to an iFrame?

Hi Team-

I could use some help here.  I have a classic ASP page that uses a iFrame.  The iFrame loads an ASP.NET page on another server.  

When my classic ASP page loads there's a QueryString value I need for my IFrame page to load correctly.

How do I pass a QueryString value to my iFrame so my ASPX page can read the value?

So here an example of my Classic ASP page URL:

http://www.myclassicasp.com/myform.asp?intakeID=12345678

Here's my iframe in my Classic ASP page:

<iframe id="myIframe" src="http://myaspxapplication.com/IntakeUpload.aspx" width="100%" frameborder="0">
</iframe>

Open in new window


Here's my code behind on my IntakeUpload.aspx page (The page that's getting loaded into my iFrame)

    Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load

        Dim intIntakeID As Nullable(Of Integer) = CInt(Request.QueryString("intakeID"))

        If intIntakeID.HasValue Then
            lbIntakeID.Text = "No Intake ID found"
        Else
            lbIntakeID.Text = intIntakeID.ToString
        End If

    End Sub

Open in new window

ASPASP.NETWeb Development

Avatar of undefined
Last Comment
cdemott33

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Big Monty

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Paul MacDonald

[Big Monty]'s example pulls the parent page AS the iframe, and I don't think that's right.  You need to pull the iframe, but call the querystring from the parent.

<iframe id="myIframe" src="http://myaspxapplication.com/myIframe.aspx?intakeID=<%=Request.QueryString("intakeID")%>" width="100%" frameborder="0">
</iframe>

Per:
http://stackoverflow.com/questions/15918480/read-query-string-parameters-from-inside-iframe

http://www.codeproject.com/Questions/500140/AccessplusQueryStringplusToplusparantpluspage-cpl
cdemott33

ASKER
Thank you.  This worked!
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck