469,921 Members | 2,183 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,921 developers. It's quick & easy.

Extracting the current URL from "Design View"

RSH
Hi,

I have a user created control that has quite a bit of codebehind code. I
have one link in the HTML page code that I need to insert the current URL
in. I have tried several scenerios but the URL always comes back with
nothing:

href="EmployerSolutions_Quote.aspx?url=<% Request.Url.ToString %>" Click
here for our
comprehensive Quote...

I need to pass the current URL to the next page so after they fill out the
quote they are returned to the page they came from. Since the control
appears throughout the site it can't be hardcoded.

How do I make that work?

Thanks!
Ron
Sep 22 '06 #1
1 1742
hi Ron,
you could do it that way. but there is always the Url.Referrer property.
note that it gets lost if you do a postback on your
EmployerSolutions_Quote.aspx page. the Referrer is itself after a postback,
if you follow. i use a base page class in most of my projects, which
persists the UrlReferrer across postbacks, so that it isn't necessary to
pass URLs around the site the whole time.

also, it might be no harm to use the explicit full URL:
Request.Url.AbsoluteUri

Request.Url.ToString() seems to give the absolute url anyway, but remember
Request.Url is only an object, and calling .ToString() on an object will
usually just give you the type name of the object.

ahhh, i just noticed, the problem is that you didn't include the = sign in
your <% code blocks.
you should have <%= Request.Url... %>

the way you have it just means that the expression is evaluated, not
outputted to the client.

hope this helps

tim
"RSH" <wa*************@yahoo.comwrote in message
news:e%****************@TK2MSFTNGP04.phx.gbl...
Hi,

I have a user created control that has quite a bit of codebehind code. I
have one link in the HTML page code that I need to insert the current URL
in. I have tried several scenerios but the URL always comes back with
nothing:

href="EmployerSolutions_Quote.aspx?url=<% Request.Url.ToString %>" Click
here for our
comprehensive Quote...

I need to pass the current URL to the next page so after they fill out the
quote they are returned to the page they came from. Since the control
appears throughout the site it can't be hardcoded.

How do I make that work?

Thanks!
Ron

Sep 23 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

36 posts views Thread by Andrea Griffini | last post: by
18 posts views Thread by Lorem Ipsum | last post: by
1 post views Thread by jloxsom | last post: by
10 posts views Thread by Wildemar Wildenburger | last post: by
7 posts views Thread by alessandro menchini | last post: by
reply views Thread by Waqarahmed | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.