getting the url of a webpage

B

bushi

hi!
i'm designing a web application,basically it have two
pages,"client_browser.apsx" & "adserver.aspx"."client_browser.aspx"
contains an iframe,and in the iframe i have displayed my
"adserver.aspx".now i want to get the URL path of the client browser
on my "adserver.aspx".but the code i have used returns me the URL
path of "adserver.aspx",as it is behind the adserver.aspx.i want to
get the URL path of the any client page displaying my server page
through iframe.any one having idea about it plz guide me.
i'm using asp.NET,C# for implementation:
the code i have used is following:

Uri vpath = HttpContext.Current.Request.UrlReferrer;
 
E

Eliyahu Goldin

On server side there is no way how a page in an iframe can know anything
about the parent.

On client side the page in the iframe can use window.parent property to get
to the containing window and get the url of the document loaded into the
containing window as parent.location.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
 
B

bushi

On server side there is no way how a page in an iframe can know anything
about the parent.

On client side the page in the iframe can use window.parent property to get
to the containing window and get the url of the document loaded into the
containing window as parent.location.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]http://msmvps.com/blogs/egoldinhttp://usableasp.net




hi!
i'm designing a web application,basically it have two
pages,"client_browser.apsx" & "adserver.aspx"."client_browser.aspx"
contains an iframe,and in the iframe i have displayed my
"adserver.aspx".now i want to get the URL path of the client browser
on my "adserver.aspx".but the code i have used returns me the URL
path of "adserver.aspx",as it is behind the adserver.aspx.i want to
get the URL path of the any client page displaying my server page
through iframe.any one having idea about it plz guide me.
i'm using asp.NET,C# for implementation:
the code i have used is following:
Uri vpath = HttpContext.Current.Request.UrlReferrer;- Hide quoted text -

- Show quoted text -

thanks Goldin!!!
it helps me,but its available within javascript,i want
to get it in the code behind file.how i can access it in the aspx.cs
file,i have used a hidden field to store its value.but when i
retreived it in the code behind file,its returning me the null
value.can i use this java script in my aspx.cs file?if yes then how?
 
E

Eliyahu Goldin

Passing the url up to the server in a hidden input field is the correct
idea. You just need to get it work.

Declare the field as
<input type=hidden runat=server id=inhUrl />

Pass the url there in javascript as
document.getElementById("inhUrl").value=myUrl

and access the value on server side as
inhUrl.Value

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net


bushi said:
On server side there is no way how a page in an iframe can know anything
about the parent.

On client side the page in the iframe can use window.parent property to
get
to the containing window and get the url of the document loaded into the
containing window as parent.location.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP
[ASP.NET]http://msmvps.com/blogs/egoldinhttp://usableasp.net




hi!
i'm designing a web application,basically it have two
pages,"client_browser.apsx" & "adserver.aspx"."client_browser.aspx"
contains an iframe,and in the iframe i have displayed my
"adserver.aspx".now i want to get the URL path of the client browser
on my "adserver.aspx".but the code i have used returns me the URL
path of "adserver.aspx",as it is behind the adserver.aspx.i want to
get the URL path of the any client page displaying my server page
through iframe.any one having idea about it plz guide me.
i'm using asp.NET,C# for implementation:
the code i have used is following:
Uri vpath = HttpContext.Current.Request.UrlReferrer;- Hide quoted
text -

- Show quoted text -

thanks Goldin!!!
it helps me,but its available within javascript,i want
to get it in the code behind file.how i can access it in the aspx.cs
file,i have used a hidden field to store its value.but when i
retreived it in the code behind file,its returning me the null
value.can i use this java script in my aspx.cs file?if yes then how?
 
B

bushi

Passing the url up to the server in a hidden input field is the correct
idea. You just need to get it work.

Declare the field as
<input type=hidden runat=server id=inhUrl />

Pass the url there in javascript as
document.getElementById("inhUrl").value=myUrl

and access the value on server side as
inhUrl.Value

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]http://msmvps.com/blogs/egoldinhttp://usableasp.net




On server side there is no way how a page in an iframe can know anything
about the parent.
On client side the page in the iframe can use window.parent property to
get
to the containing window and get the url of the document loaded into the
containing window as parent.location.
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP
[ASP.NET]http://msmvps.com/blogs/egoldinhttp://usableasp.net

hi!
i'm designing a web application,basically it have two
pages,"client_browser.apsx" & "adserver.aspx"."client_browser.aspx"
contains an iframe,and in the iframe i have displayed my
"adserver.aspx".now i want to get the URL path of the client browser
on my "adserver.aspx".but the code i have used returns me the URL
path of "adserver.aspx",as it is behind the adserver.aspx.i want to
get the URL path of the any client page displaying my server page
through iframe.any one having idea about it plz guide me.
i'm using asp.NET,C# for implementation:
the code i have used is following:
Uri vpath = HttpContext.Current.Request.UrlReferrer;- Hide quoted
text -
- Show quoted text -
thanks Goldin!!!
it helps me,but its available within javascript,i want
to get it in the code behind file.how i can access it in the aspx.cs
file,i have used a hidden field to store its value.but when i
retreived it in the code behind file,its returning me the null
value.can i use this java script in my aspx.cs file?if yes then how?- Hide quoted text -

- Show quoted text -

thanx Goldin!!!
i have done it in the same way.its working.............
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top