November Happy Hour will be moved to Thursday December 5th.

Url-friendly string in EPiServer 4.62b

Vote:
 

Hi

I've got a problem, I need to convert a string with special characters like "Série" to "Serie" and insert into "Page name in Web address". In episerver 4.62b the name of a page is saved in this kind of friendly string into the property "Page name in Web address" when you hit the "Save and publish"-button and the field is empty, but when you save a page programatically the string does not get saved.
Is there a way to use this EPiServer function programatically, or do i need to do it the hard way with Regex?

#40005
Jun 08, 2010 15:52
Vote:
 

Do you set the saveaction to publish= http://world.episerver.com/Get-Started/Developing-with-EPiServer-CMS/Getting-Started-Developing-with-EPiServer-CMS-5/Create-a-Page-Programmatically/

I did a quick test in edit mode on an old site and if you just save the page the "name in web adress" doesn't get updated but that's done as soon as you publish the page.

/Per

#40015
Jun 08, 2010 22:52
Vote:
 

Hi

Yes, I am using this line to save the page

Global.EPDataFactory.Save(Page,EPiServer.DataAccess.SaveAction.Publish,0);

I find it strange that EPiServer handles "Save and Publish" and Global.EPDataFactory.Save with SaveAction.Publish differently.
I guess that you can't reach this code which activates when you press the "Save and Publish" button, but is there a way to easily mimic it?

#40017
Jun 09, 2010 8:18
Vote:
 

You could always use Reflector to find out how EPiServer handles the Save&Publish-event. I don't have any dlls for EPi4 on this computer, so you have to do that by yourself.

#40028
Jun 09, 2010 10:33
Vote:
 

Hi

I've managed to get the code which EPiServer uses, though I had to modify it, it works really well. Now I dare not to think of how the Asian languages will do with this, I guess it will have to be modified again when that time comes.

Thank you all for your help.

#40072
Jun 09, 2010 15:58
Vote:
 

In CMS 6 you can do it like this: myPage.URLSegment = EPiServer.Web.UrlSegment.CreateUrlSegment(myPage); Maybe similiar in 4.X

 

#40642
Jun 14, 2010 22:41
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.