System.Runtime.Remoting.Channels.Http.HttpChannelHelper.ParseURL C# (CSharp) Метод

ParseURL() статический приватный Метод

static private ParseURL ( String url, String &objectURI ) : String
url String
objectURI String
Результат String
        internal static String ParseURL(String url, out String objectURI)
        {            
            // Set the out parameters
            objectURI = null;

            int separator = StartsWithHttp(url);
            if (separator == -1)
                return null;

            // find next slash (after end of scheme)
            separator = url.IndexOf('/', separator);
            if (-1 == separator)
            {
                return url;  // means that the url is just "tcp://foo:90" or something like that
            }

            // Extract the channel URI which is the prefix
            String channelURI = url.Substring(0, separator);

            // Extract the object URI which is the suffix (leave the slash)
            objectURI = url.Substring(separator);

            InternalRemotingServices.RemotingTrace("HTTPChannel.Parse URI in: " + url);
            InternalRemotingServices.RemotingTrace("HTTPChannel.Parse channelURI: " + channelURI);
            InternalRemotingServices.RemotingTrace("HTTPChannel.Parse objectURI: " + objectURI);

            return channelURI;
        } // ParseURL

Usage Example

        string GetRequestUriForCurrentRequest(HttpContext context)
        {
            // we need to pull off any http specific data plus the application v-dir name
            String rawUrl = context.Request.RawUrl;
            // here's where we pull off channel info
            String channelUri;
            String requestUri;

            channelUri = HttpChannelHelper.ParseURL(rawUrl, out requestUri);
            if (channelUri == null)
            {
                requestUri = rawUrl;
            }

            // here's where we pull off the application v-dir name
            String appName = RemotingConfiguration.ApplicationName;

            if (appName != null && appName.Length > 0 && requestUri.Length > appName.Length)
            {
                //  "/appname" should always be in front, otherwise we wouldn't
                //   be in this handler.
                requestUri = requestUri.Substring(appName.Length + 1);
            }

            return(requestUri);
        }
All Usage Examples Of System.Runtime.Remoting.Channels.Http.HttpChannelHelper::ParseURL