Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Extracting the current URL from "Design View"

Reply
Thread Tools

Extracting the current URL from "Design View"

 
 
RSH
Guest
Posts: n/a
 
      09-22-2006
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


 
Reply With Quote
 
 
 
 
Tim_Mac
Guest
Posts: n/a
 
      09-23-2006
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" <> wrote in message
news:e%...
> 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
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
printing out the current URL for current ASP page in Perl Jack Perl Misc 3 12-22-2008 02:35 PM
Possible to show an iframe's current location (current URL) liketofindoutwhy@gmail.com Javascript 1 03-19-2008 10:20 PM
Current url inside another url teej HTML 1 04-28-2005 04:39 PM
URL - substitution of a correct URL by a GUID like URL in favorites. Just D. ASP .Net Mobile 0 08-11-2004 04:26 PM
redirect URL's, return URL's, and URL Parameters Jon paugh ASP .Net 1 07-10-2004 05:29 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57