Solved

Get the parent URL for an iFrame

Posted on 2013-05-28
5
726 Views
Last Modified: 2013-08-13
I have a page on one domain.  (www.mypage.com/mydirectory/defaults.asp)

Within this page is an iframe that points to a different URL.  (www.differenturl.com/calendar.aspx)

When the calendar.aspx page loads in the iFrame I need it to get the URL of the page that loaded the iFrame.  So basically I need it get this:

www.mypage.com/mydirectory/

Is there a way to do this?  If so, can you please explain how.  Thanks!
0
Comment
Question by:cdemott33
  • 2
  • 2
5 Comments
 
LVL 6

Expert Comment

by:RaithZ
ID: 39202389
That may be listed in the referrer information in the http headers.
0
 

Author Comment

by:cdemott33
ID: 39202401
Is there a way I could get this information using VB.NET?  If so, how?
0
 
LVL 12

Accepted Solution

by:
Jitendra Patil earned 500 total points
ID: 39204236
Hi cdemott33

try this way,

.aspx code
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
        <body>
            <form id="form2" runat="server">
            <iframe id="Iframe1" runat="server" src="http://www.google.com" height="200px" width="200px"></iframe>
            <asp:Button ID="btnget" runat="server" Text="GetParentURL" />
            </form>
        </body>
</html>

.vb code

Imports System.Data
Public Class _Default
    Inherits System.Web.UI.Page
   
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
       
    End Sub

    Protected Sub btnget_Click(sender As Object, e As EventArgs) Handles btnget.Click
        Response.Write(Request.UrlReferrer.ToString())
    End Sub
End Class

hope this helps.
0
 

Author Comment

by:cdemott33
ID: 39204490
Hi  patil786 -

When I click the button the response.write displays "www.google.com".  I want to get www.mypage.com/mydirectory/defaults.asp. Any thoughts on how I can do this?
0
 
LVL 12

Expert Comment

by:Jitendra Patil
ID: 39204714
can you post your code here.

are you referring any google code like google checkout, payment gateway etc..
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now