Developer forum

Forum » Dynamicweb 9.0 Upgrade issues » Url tags/property

Url tags/property

Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Hi,

 

I ran into an issue in DW9. My goal is to get:

  1. Relative path (unfriendly url)
    i.e. "/Default.aspx?ID=1&q=search-text"
  2. Relative path (friendly url)
    i.e. "/mypage?q=search-text"

 

The problem is that I feel I am getting the wrong values and/or not doing it the best/proper way. Can anyone validate this for me?

  1. Dynamicweb.Context.Current.Request.RawUrl
    but despite being RawUrl I get something like this - /my-account/latest-orders?CCOrderByField69=Id&CCSortOrder69=Asc
    I could we just get it using Dynamicweb.Context.Current.Request.Url.PathAndQuery
     
  2. Pageview.GlobalTags.GetTagByName("Global:Pageview.Url").Value
    but how would I get it without using GlobalTags? - essentially what I need is what RawUrl is currently rendering but it sounds wrong to use that property

 

Best Regards,

Nuno Aguiar


Replies

 
Nicolai Pedersen
Reply
This post has been marked as an answer

I think rendering that property is just fine.

BR Nicolai

Votes for this answer: 1
 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Hi Nicolai,

 

  1. You're saying I should be using RawUrl (which is giving me the friendly Url) - meaning there's a bug?
    Or you're saying there's no bug and RawUrl should be providing the friendly Url and I should be using Url.PathAndQuery?
     
  2. If on #1 there are not bugs, it means I can use RawUrl instead of GlobalTags, but I want to be confirm

 

Nuno

 
Nicolai Pedersen
Reply

There are no bugs. The rest I do not understand... smiley

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Hi Nicolai,

 

Ok, withno bugs then (so to say it differently):

  • To get the "unfriendly Url" we will use Dynamicweb.Context.Current.Request.Url.PathAndQuery
  • To get the "friendly Url" we will use Dynamicweb.Context.Current.Request.RawUrl

 

Thank you,

Nuno

 

You must be logged in to post in the forum