Error with SharePoint login

Feb 2, 2009 at 4:46 PM
Hi, I'm getting this error when trying to login using windows authentication:

Length cannot be less than zero.
Parameter name: length   at System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy)
   at System.String.Substring(Int32 startIndex, Int32 length)
   at ManagedFusion.Rewriter.RuleSetCollection.get_Item(String relativePath)
   at ManagedFusion.Rewriter.RuleSetCollection.RunRules(HttpContext context)
   at ManagedFusion.Rewriter.RewriterModule.context_BeginRequest(Object sender, EventArgs e)
   at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously

I've not got any rewrite rules in place as yet.


Coordinator
Feb 2, 2009 at 5:49 PM
Edited Feb 2, 2009 at 5:49 PM
Are you using the latest version from the Releases tab? Version 2.5?
Feb 3, 2009 at 9:35 AM
Thanks, I took the latest version and get this error instead:

Length cannot be less than zero.
Parameter name: length   at System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy)
   at ManagedFusion.Rewriter.RuleSetCollection.get_Item(String relativePath) in C:\Users\Nick\Documents\Projects\Managed Fusion\ManagedFusion.Rewriter\Source\RuleSetCollection.cs:line 90
   at ManagedFusion.Rewriter.RuleSetCollection.RunRules(HttpContext context) in C:\Users\Nick\Documents\Projects\Managed Fusion\ManagedFusion.Rewriter\Source\RuleSetCollection.cs:line 119
   at ManagedFusion.Rewriter.RewriterModule.context_BeginRequest(Object sender, EventArgs e) in C:\Users\Nick\Documents\Projects\Managed Fusion\ManagedFusion.Rewriter\Source\RewriterModule.cs:line 138
   at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

Is this supported with SharePoint?








Feb 3, 2009 at 9:36 AM

I debbuged the code and although I don't fully understand, the error is occuring because of the path value operation in RuleSetCollection.GetRelativePath

path value is 'C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\template\layouts\Authenticate.aspx'
_applicationPath value is 'C:\Inetpub\wwwroot\wss\VirtualDirectories\80\'

path = path.Substring(_applicationPath.Length - 1);

return value is 'ed\Web Server Extensions\12\template\layouts\Authenticate.aspx'

and this causes it to fail further downstream.
Coordinator
Feb 3, 2009 at 1:20 PM
Edited Feb 3, 2009 at 1:38 PM
Please contact me at support at managedfusion.com and we can take this off line.  I see no reason why SharePoint shouldn't work, but to be honest it is only in the past couple of weeks that I have had users e-mailing me that they are trying to use my URL Rewriter with SharePoint.  So we are both on new grounds. 

I think it has to do with the fact that SharePoint has it's own URL Rewriter and we are adding another one on top of that.  So there are probably a couple of HttpContext issues that we need to work though. 

Also your above discover means that the path I am searching the "ApplicationPath" isn't the same path as the project is executing in.  We may need to add an end-run around the dirctory scanning engine for this purpose.  And point physically at the URL Rewriter rules.
Coordinator
Feb 3, 2009 at 1:22 PM
>> I've not got any rewrite rules in place as yet.

Oh this may be your issue.  It shouldn't be throwing an error but it is probably looking for rules that don't exist.  Either way e-mail me.