UrlRewriter Exception

This is the place to report bugs and get support. When posting in this forum, please always provide as much detail as possible.

Please do not report problems with a custom build or custom code in this forum. If you are producing your own build from the source code and have problems or questions, ask in the developer forum, do not report it as a bug.

This is the place to report bugs and get support

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.
Please do not report problems with a custom build or custom code in this forum. If you are producing your own build from the source code and have problems or questions, ask in the developer forum.
This thread is closed to new posts. You must sign in to post in the forums.
3/5/2009 9:58:16 AM
Gravatar
Total Posts 9

UrlRewriter Exception

When making a request to the virtual root (without a trailing slash) under IIS, the following exception is thrown:

[ArgumentOutOfRangeException: startIndex cannot be larger than length of string. Parameter name: startIndex] System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy) +10080140 System.String.Substring(Int32 startIndex) +19 mojoPortal.Web.UrlRewriter.RewriteUrl(HttpApplication app) in D:\Projects\KRB\MojoPortal\Web\Components\UrlRewriter.cs:133 mojoPortal.Web.UrlRewriter.UrlRewriter_BeginRequest(Object sender, EventArgs e) in D:\Projects\KRB\MojoPortal\Web\Components\UrlRewriter.cs:71 System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +80 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +171

 

That is line 133 of UrlRewriter.cs:
string targetUrl = requestPath.Substring(appRoot.Length + 1);

which can be rewriiten to fix:

string appRoot = WebUtils.GetApplicationRoot();
if (requestPath.Length == appRoot.Length)
return;
string targetUrl = requestPath.Substring(appRoot.Length + 1);

 

Example of url that causes exception: http://localhost/mojo (fails) as opposed to http://localhost/mojo/ (succeeds).

3/5/2009 11:34:29 AM
Gravatar
Total Posts 18439

Re: UrlRewriter Exception

Hi,

Thanks for the bug report and the fix. I've just committed the change to svn trunk.

Best,

Joe 

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