diff options
author | rbazinet-exago <38866938+rbazinet-exago@users.noreply.github.com> | 2018-04-30 23:11:15 +0300 |
---|---|---|
committer | Marek Safar <marek.safar@gmail.com> | 2018-05-03 00:25:52 +0300 |
commit | 6c465b42d56dfc47eef826c5904cc85a9059eaf1 (patch) | |
tree | e3da26c1a806f80791a2e8bb2c2e0bb5e64a284b /mcs/class/System.Web | |
parent | 672a15278ddfffba647d94a32a8b2f0df3de1d84 (diff) |
Update HtmlForm.cs for issue #8526
When running with cookieless sessions, the file_path does not necessarily contain a leading '/' character which can lead to a Uri being constructed from something that looks like, "http://hostmyPage.aspx" which immediately fails and throw an exception stating that the hostname could not be parsed.
Diffstat (limited to 'mcs/class/System.Web')
-rw-r--r-- | mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlForm.cs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlForm.cs b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlForm.cs index 4fa9af17d06..2be1cdfe71e 100644 --- a/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlForm.cs +++ b/mcs/class/System.Web/System.Web.UI.HtmlControls/HtmlForm.cs @@ -253,7 +253,10 @@ namespace System.Web.UI.HtmlControls if (cookieless) { Uri current_uri = new Uri ("http://host" + current_path); - Uri fp_uri = new Uri ("http://host" + file_path); + //Determine if the file_path is rooted (ie starts with a '/') + //and inject a '/' into the Uri string accordingly. + string separator = file_path[0] == '/' ? "" : "/"; + Uri fp_uri = new Uri ("http://host" + separator + file_path); action = fp_uri.MakeRelative (current_uri); } else action = current_path; |