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 (show other bugs)
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)

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


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!

Note You need to log in before you can comment on or make changes to this bug.