Solved

Get the parent URL for an iFrame

Posted on 2013-05-28
5
790 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

830 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