Click here to Skip to main content
15,868,005 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
I have a situation where I need to have users click a link via email have the link take them to a specific web page on my site. Normally this is day 1 HTML coding, but I'm using iFrames. I know better than to use iFrames, but in this case, I have no choice.

To get around this problem, I add a parameter to my QuesryString, then retrieve it during my PageLoad on my Default.aspx page. The Default.aspx page contains 2 iFrames, 1 for my header and 1 for my body content.

I want to read my QueryString parameter, and if it is set (myUrl/default.aspx?forward=yes) then I want my body content iFrame to go to a specific page.

C#
protected void Page_Load(object sender, EventArgs e)
    {
        //Forward url if param found in querystring
        string urlForward = "";
        urlForward = Request.QueryString["forward"];
        string newPage = "MyNewPage.aspx";
        if (urlForward == "yes")
        {

        //Code to forward to a specific page in the body content iFrame

        }
     }
Posted

1 solution

try this

iframe2.Attributes["src"] = "https://www.google.com";
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900