Beispiel #1
0
        internal UrlBuilder(HttpContextBase httpContext, VirtualPathUtilityBase virtualPathUtility, string path, object parameters)
        {
            _params             = new StringBuilder();
            _virtualPathUtility = virtualPathUtility;

            Uri uri;

            if (Uri.TryCreate(path, UriKind.Absolute, out uri))
            {
                _path = uri.GetLeftPart(UriPartial.Path);
                _params.Append(uri.Query);
            }
            else
            {
                _path = GetPageRelativePath(httpContext, path);
                var index = (_path ?? string.Empty).IndexOf('?');
                if (index != -1)
                {
                    _params.Append(_path.Substring(index));
                    _path = _path.Substring(0, index);
                }
            }

            if (parameters != null)
            {
                AddParam(parameters);
            }
        }
Beispiel #2
0
        internal UrlBuilder(HttpContextBase httpContext, VirtualPathUtilityBase virtualPathUtility, string path, object parameters) {
            _params = new StringBuilder();
            _virtualPathUtility = virtualPathUtility;

            Uri uri;
            if(Uri.TryCreate(path, UriKind.Absolute, out uri)) {
                _path = uri.GetLeftPart(UriPartial.Path);
                _params.Append(uri.Query);
            }
            else {
                _path = GetPageRelativePath(httpContext, path);
                var index = (_path ?? string.Empty).IndexOf('?');
                if(index != -1) {
                    _params.Append(_path.Substring(index));
                    _path = _path.Substring(0, index);
                }
            }

            if(parameters != null) {
                AddParam(parameters);
            }
        }