Extensionless Friendly Urls

Post here for help with installing or upgrading mojoPortal pre-compiled release packages. When posting in this forum, please provide all relevant details. You may also want to review the installation or upgrading documentation.

If you have questions about using the source code or working with mojoPortal in Visual Studio, please post in the Developer forum.

Post here for help with installation of mojoPortal pre-compiled release packages

When posting in this forum, please try to provide as many relevant details as possible. Particularly the following:

  • What operating system were you running when the bug appeared?
  • What database platform is your site using?
  • What version of mojoPortal are you running?
  • What version of .NET do you use?
  • What steps are necessary to reproduce the issue? Compare expected results vs actual results.

You may also want to review the installation or upgrading documentation.

If you have questions about using the source code or working with mojoPortal in Visual Studio, please post in the Developer forum.

This thread is closed to new posts. You must sign in to post in the forums.
5/23/2008 1:44:42 PM
Gravatar
Total Posts 12

Extensionless Friendly Urls

I'm tring to get extensionless friendly urls working as described here: http://www.mojoportal.com/friendly-url-mapping.aspx

I tried creating a directory with an empty Default.aspx in it, all I got was an empty web page returned.  Does this method still work?

I've also been tring to add the .net isapi handler to IIS Site Properties->Home Directory->Application Settings->Configuration->Wildcard Application Maps with "Verify File Exists" unchecked.   This is what I do for my other ASP.net sites and it works great to get asp to catch all the requests.

When I try this with mojoportal though I get errors like this:

2008-05-23 13:13:23,010 [5120] ERROR mojoPortal.Web.Global [(null)] - 67.177.40.217-en-US - /Run
System.Web.HttpException: File does not exist.
at System.Web.StaticFileHandler.RespondUsingVirtualFile(String virtualPath, HttpResponse response)
at System.Web.StaticFileHandler.ProcessRequestInternal(HttpContext context)
at System.Web.DefaultHttpHandler.BeginProcessRequest(HttpContext context, AsyncCallback callback, Object state)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

Also the home page appears to be broken when the wildcard map is on (eg http://mojoportal.com fails, but http://mojoportal.com/Default.aspx works.)  Is there possibly a fix that could be added to mojoportal to make the wildcard application map method work?  I think it'd make everything much cleaner.

Also, is there any chance that the friendly url renamer could preserve the case of the title?  I think ~/Forum.aspx looks alot better than ~/forum.aspx.  I've been changing them by hand and it's just a little tedious.

Joe, thank you so much for all you do for mojoportal.  It is the finest CMS I've ever used.

Bryan

5/23/2008 2:10:14 PM
Gravatar
Total Posts 12

Re: Extensionless Friendly Urls

5/24/2008 7:42:10 AM
Gravatar
Total Posts 18439

Re: Extensionless Friendly Urls

Hi Bryan,

That page is an old blog post from June 2005 and if you'll notice, the url in the post for forums doesn't work anymore. At thetime, mojoPortal.com was hosted on Linux/Mono and the url worked, but when 2.0 .NET came out I had to move to Windows hosting because it would take Mono a while to catchup.

If .NET is truly handling all requests, the extensionless urls will work as it does work on mono, but if IIS is handling the url first then it will interpret the lasdt segment of the url as a folder and will look for that folder and try to find a default document like Default.aspx or index.html (depending on configuration of course)

So in IIS if I want to use the friendly url

http://mysite.com/forums

if .NET was the first in the chain to handle this request, then my friendly url would be ~/forums and it would map to ~/Default.aspx?pageid=x and no .aspx extension would be needed in the friendly url.

In a normal IIS environment, it will result in 404 page not found, but if I actually create a folder named forums and put an empty Default.aspx file there to be a default document, then IIS will hand the request to .NET

Now in order to make .NET handle the request correctly, I need a friendly url mapping with the friendly url

~/forums/Default.aspx mapping to ~/Default.aspx?pageid=x

In my opinion its really too much trouble trying to use extensionless urls on Windows and my recommendation is just use .aspx extensions to keep it simple.

I really don't know much about the wildcard application map or what it is for or how to use it, so I don't know the answer to that question. My emphasis is on making mojoportal work in common hosted environments rather than making sure it supports all manner of custom environments.

I will add a config option about the forcing of lower case for suggested friendly urls in the next release, it is currently not configurable. Myself I think its best to use lower case for several reasons though I will make it an option for those who disagree. In trying to be a truly cross platform solution I always want to use consistent and correct casing for urls because only Windows has case insensitive file system and on *nix systems /Forums.aspx is not the same url as /forums.aspx and would result in a 404 if the real url is forums.aspx. So to insure it will work if I ever decide to move the site again to linux/Mono hosting I want to make sure my urls are consistent and lower case urls are easier to type and since they are case sensitive on other platforms I don't want users to have to type the url in correct mixed casing to avoid 404, instead I expect them to always use lower case.

Best,

Joe

5/24/2008 5:07:11 PM
Gravatar
Total Posts 12

Re: Extensionless Friendly Urls

You should add this syntax to your note on UrlManager.aspx as I'd never have guessed that I would have needed to do that: ~/forums/Default.aspx mapping to ~/Default.aspx?pageid=x

I was able to get this method working, but I had to add the physical folder and default.aspx director after adding the Url Mapping or else the mapper would throw this error: "Cannot create this url because it would mask a physical page."  I think this might be a bug.  Also, I can't modify the mapping unless I remove or rename the physical file.

In the past I've taken sites from html->cgi->perl->php->aspx.  Each time I've changed the extensions and lost pagerank for the pages and probably a few thousand dollars worth of revenue, so it's pretty important to me now to have the exact url's that I want.  I also sometimes deal with that hard core linux crowd that probably scowls every time they see a .aspx.  I should probably look into some of the url rewriter programs to do this right.

Thanks again for your help and for the great software.

Bryan

You must sign in to post in the forums. This thread is closed to new posts.