Url containg .(Dot) does not resolve.

Vote:
 

Hi,

I have published a blog that was assigned this url "http://world.episerver.com/blogs/K-Khan-/Dates/2014/12/trailing-slashes-in-website./"

it takes the visitors to, it looks me a bug somewhere in routing. I tested in alloy site, if we change Name In URL from "testpage" to "testpage." this page will not be resolve and will generate same error. I think it should be logged as bug if not before and need a fix.

Server Error in '/' Application.

The resource cannot be found.

Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable.  Please review the following URL and make sure that it is spelled correctly. 

Requested URL: /blogs/K-Khan-/Dates/2014/12/trailing-slashes-in-website./

#114045
Dec 03, 2014 11:41
Vote:
 

Hi,

You cannot have dots in the end of an URL - no matter if it's a blog post or a forum post, like this one. I've corrected the URLs now, and the developers in the Web Team are trying to find a "cleaning" solution for removing dots in the URL, here on World anyway. 

Best regards,

Per Vikström

Online Manager
Team Leader Web Team

#114061
Edited, Dec 03, 2014 15:40
Vote:
 

I can replicate that in Alloy site also and in my project also. that means client can break the site. It will be great if in online site we could restrict the editors to enter Dot in URL name field.
Regards
/K

#114064
Dec 03, 2014 15:45
Vote:
 

Please contact the Support regarding this issue, since it seems like an easy mistake that can cause a large (and bad) effect. Thanks.

Best regards,

Per

#114065
Dec 03, 2014 15:50
Vote:
 

We have noticed the same behavior and I'd say it's a bug in the way Episerver calculates the UrlSegment from the name. It should strip out periods. I believe the method in use is UrlSegment.GetUrlFriendlySegment. Looking at the code, there is a regexp that lists allowed characters, and it will explicitly allow periods (dots).

#114072
Dec 04, 2014 8:46
Vote:
 

The reason '.' are allowed in the url segment is primarly for media where you want to have a segment like "myimage.png" and not e.g. "myimage_png".

It seems that Asp.net however does not allow request with a trialing '.' (that is the request never gets to EPiServer routing) so we should add a validation that urlsegment should not end with a '.'

#114080
Dec 04, 2014 9:53
Vote:
 

I used this as workaround in a recent project:

	/// <summary>
	/// You can publish content with URL segments that ends with a dot, but it will cause a 404, this should fix it.
	/// </summary>
	[InitializableModule]
	[ModuleDependency(typeof(ServiceContainerInitialization))]
	public class RemoveDotsInUrlSegmentInitializer : IInitializableModule
	{
		public void Initialize(InitializationEngine context)
		{
			var eventRegistry = ServiceLocator.Current.GetInstance<IContentEvents>();
			eventRegistry.PublishingContent += EventRegistryOnPublishingContent;
		}

		/// <summary>
		/// Dots in the route segment generates a 404
		/// </summary>
		private void EventRegistryOnPublishingContent(object sender, ContentEventArgs contentEventArgs)
		{
			var routable = contentEventArgs.Content as IRoutable;
			if(routable != null && !string.IsNullOrEmpty(routable.RouteSegment) && routable.RouteSegment.EndsWith(".")) {
				routable.RouteSegment = routable.RouteSegment.TrimEnd(new []{'.'});
				contentEventArgs.Content = routable as IContent;
			}
		}

		public void Uninitialize(InitializationEngine context) {}
		public void Preload(string[] parameters) {}
	}
#114111
Dec 04, 2014 15:05
Vote:
 

This is solved in the latest version of EPiServer. Could not find the bug report for this issue so I'm not sure in which specific version but the trailing dot is removed in the segment url in EPiServer version 8.3 (not in 8.1 as previously said).

PageName: "Øyvind D.C." get segment url "oyvind-d.c"

#119282
Edited, Mar 26, 2015 8:34
Vote:
 

I appriciate EPiServer team that they are improving product at every possible level.
/K

#119284
Mar 26, 2015 9:19
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.