+2008-08-19 Marek Habersack <mhabersack@novell.com>
+
+ * UrlUtils.cs: fail gracefully if the path passed to GetSessionId
+ is null.
+
2008-07-29 Marek Habersack <mhabersack@novell.com>
* UrlUtils.cs: fixed a typo in HasSessionId which made it always
internal static string GetSessionId (string path)
{
+ if (path == null)
+ return null;
+
string appvpath = HttpRuntime.AppDomainAppVirtualPath;
- if (path.Length <= appvpath.Length)
+ int appvpathlen = appvpath.Length;
+
+ if (path.Length <= appvpathlen)
return null;
- path = path.Substring (appvpath.Length);
- if (path.Length == 0 || path [0] != '/')
+ path = path.Substring (appvpathlen);
+
+ int len = path.Length;
+ if (len == 0 || path [0] != '/') {
path = '/' + path;
+ len++;
+ }
- int len = path.Length;
if ((len < SessionId.IdLength + 3) || (path [1] != '(') ||
(path [SessionId.IdLength + 2] != ')'))
return null;