This is Xamarin's bug tracking system. For product support, please use the support links listed in your Xamarin Account.
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: Sys.Web (show other bugs)
Version: master
Hardware: PC Linux
: --- normal
Target Milestone: ---
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)

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


Attachments

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 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.