Bug 36724 - Error when inserting SessionID into Uri on Linux
Summary: Error when inserting SessionID into Uri on Linux
Status: CLOSED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: System.Web (show other bugs)
Version: master
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-12-08 17:57 UTC by Arsen.Shnurkov
Modified: 2015-12-10 00:22 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
CLOSED FIXED

Description Arsen.Shnurkov 2015-12-08 17:57:22 UTC
https://github.com/mono/mono/blob/f48d6486a1532d5a1501718ac5b5d031d6e22710/mcs/class/System.Web/System.Web.Util/UrlUtils.cs#L57

path can be empty, thus giving IndexOutOfRangeException

the line
    if (path [0] == '/')
should be replaced with
    if (path.StartsWith("/"))

the error text is


System.IndexOutOfRangeException
Index was outside the bounds of the array.

Description: HTTP 500.Error processing request.

Details: Non-web exception. Exception origin (name of application or object): System.Web.
Exception stack trace:
    at System.Web.Util.UrlUtils.InsertSessionId (System.String id, System.String path) in /var/tmp/portage/dev-lang/mono-4.2.1.91-r1/work/mono-4.2.1/mcs/class/System.Web/System.Web.Util/UrlUtils.cs:line 57
    at System.Web.SessionState.SessionIDManager.SaveSessionID (System.Web.HttpContext context, System.String id, System.Boolean& redirected, System.Boolean& cookieAdded) in /var/tmp/portage/dev-lang/mono-4.2.1.91-r1/work/mono-4.2.1/mcs/class/System.Web/System.Web.SessionState_2.0/SessionIDManager.cs:line 126
    at System.Web.SessionState.SessionStateModule.OnAcquireRequestState (System.Object o, System.EventArgs args) in /var/tmp/portage/dev-lang/mono-4.2.1.91-r1/work/mono-4.2.1/mcs/class/System.Web/System.Web.SessionState_2.0/SessionStateModule.cs:line 232
    at System.Web.HttpApplication+<RunHooks>c__Iterator0.MoveNext () in /var/tmp/portage/dev-lang/mono-4.2.1.91-r1/work/mono-4.2.1/mcs/class/System.Web/System.Web/HttpApplication.cs:line 1030 at System.Web.HttpApplication+<Pipeline>c__Iterator1.MoveNext () in /var/tmp/portage/dev-lang/mono-4.2.1.91-r1/work/mono-4.2.1/mcs/class/System.Web/System.Web/HttpApplication.cs:line 1292
    at System.Web.HttpApplication.Tick () in /var/tmp/portage/dev-lang/mono-4.2.1.91-r1/work/mono-4.2.1/mcs/class/System.Web/System.Web/HttpApplication.cs:line 927

Version Information: 4.2.1 (Stable 4.2.1.91/8862921 Tue Dec 1 14:29:07 MSK 2015); ASP.NET Version: 4.0.30319.17020
Powered by Mono


steps to reproduce:
1) turn on the option 
<configuration>
  <system.web>
    <sessionState cookieless= "UseUri" /> 
in web.config
2) open the root page of site
Comment 1 Arsen.Shnurkov 2015-12-09 19:52:24 UTC
https://github.com/mono/mono/pull/2312
Comment 2 Alexander Köplinger [MSFT] 2015-12-10 00:13:09 UTC
Merged the PR. Thanks!