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

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:

Description Arsen.Shnurkov 2015-12-08 17:57:22 UTC

path can be empty, thus giving IndexOutOfRangeException

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

the error text is

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- 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- 126
    at System.Web.SessionState.SessionStateModule.OnAcquireRequestState (System.Object o, System.EventArgs args) in /var/tmp/portage/dev-lang/mono- 232
    at System.Web.HttpApplication+<RunHooks>c__Iterator0.MoveNext () in /var/tmp/portage/dev-lang/mono- 1030 at System.Web.HttpApplication+<Pipeline>c__Iterator1.MoveNext () in /var/tmp/portage/dev-lang/mono- 1292
    at System.Web.HttpApplication.Tick () in /var/tmp/portage/dev-lang/mono- 927

Version Information: 4.2.1 (Stable 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 
    <sessionState cookieless= "UseUri" /> 
in web.config
2) open the root page of site
Comment 1 Arsen.Shnurkov 2015-12-09 19:52:24 UTC
Comment 2 Alexander Köplinger [MSFT] 2015-12-10 00:13:09 UTC
Merged the PR. Thanks!