Developer forum

Forum » Development » SearchEngineFriendlyURLs.getSearchFriendlyUrl() and -1

SearchEngineFriendlyURLs.getSearchFriendlyUrl() and -1

Mikkel Høst
Reply

Hello.

I have a problem with this method :

SearchEngineFriendlyURLs.getSearchFriendlyUrl() 

I use it in a very simple way

string url = "Default.aspx?ID=" + pageid + "&ProductID=" + reader["ProductID"];

I build a url and use this as input. This works greats on all most every product. Sometimes DW add this -1 to the URL, i think i does so when there are products with the same name. The method doesn't seem to do this, because when i generate the list and paste in this URL it gives me 404. If i add the -1 it works. 

Can anybody help me out? I tryed the support but they said i should try here on the forum :)

If the method is "broken" does anybody know how and when the "-1" get added so i could code this case my self?

DW version is 19.2.9.2


Replies

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Looks like a bug to me. As far as I can see, that method should return the same URL that is used to generate the URL internally. I wouldn't try to create a proper URL myself, as that might break in the future.

 

Maybe report it again in the support system as a bug?

 

Imar

 
Nuno Aguiar
Reply

Hi Mikkel,

 

I actually know and we've reported it as a bug.

 

When you create 2 pages with the same name, and when the friendly URL settings get into a conflict, the system adds "-1" to the old page, instead of the new one.

 

If you have a 3rd page, then the oldest with have "-2", the second oldest "-1"

 

Hopefully it will be corrected in the near future.

 

Nuno

 
Mikkel Høst
Reply

Hi Imar and Nuno.

Looks like at bug to me 2 but, but NP didn't think so in the support case. Nuno could you give med the case ID or bug ID so i could look at this case, maybe refer to it when i create mine?

Thanks guys!

 
Nuno Aguiar
Reply

Hi Mikkel,

 

It's case  number CAS-93060-70DX3K. It was created by Diogo Brito (a colleague of mine).

 

I noticed this as a standard friendly URL bug, but from your description is the same thing.

 

Nuno

 
Nicolai Høeg Pedersen
Reply
This post has been marked as an answer

Hi Mikkel

 

You would usually not call that method. DW will take care of handling the URLs for you, so simply print out the Default.aspx?ID&etc url to the markup, and Dynamicwebs output handler will take care of the rest.

 

When you call that method, you might be 'out of context' - there are language and website settings that have an impact on what that method returns since several product languages and variants can hold the same name.

Votes for this answer: 1
 
Mikkel Høst
Reply

Hi NP.

Well that makes sense :) - Thanks for the reply.

And in this scenario i can do this, but i would be nice if you could overload this method with the requried context settings. So we could use this out of context. I have worked with different clients who wants all product urls from the site in their ERP etc so they can automate adwords and all that jazz.

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Ah, I see now why it's not classified as a bug. But yes, an overload that allows you to specify this would be great. Having the ability to generate / predicate a custom URL us very useful....

 

Imar

 

You must be logged in to post in the forum