System.Net.CookieParser.CheckQuoted C# (CSharp) Method

CheckQuoted() static private method

static private CheckQuoted ( string value ) : string
value string
return string
        internal static string CheckQuoted(string value)
        {
            if (value.Length < 2 || value[0] != '\"' || value[value.Length - 1] != '\"')
                return value;

            return value.Length == 2 ? string.Empty : value.Substring(1, value.Length - 2);
        }
    }

Usage Example

示例#1
0
        private void BuildCookieCollectionFromDomainMatches(Uri uri, bool isSecure, int port, CookieCollection cookies, List <string> domainAttribute, bool matchOnlyPlainCookie)
        {
            for (int i = 0; i < domainAttribute.Count; i++)
            {
                bool     found        = false;
                bool     defaultAdded = false;
                PathList pathList;
                lock (_domainTable)
                {
                    _domainTable.TryGetValue(domainAttribute[i], out pathList);
                }

                if (pathList == null)
                {
                    continue;
                }

                lock (pathList.SyncRoot)
                {
                    foreach (DictionaryEntry entry in pathList)
                    {
                        string path = (string)entry.Key;
                        if (uri.AbsolutePath.StartsWith(CookieParser.CheckQuoted(path)))
                        {
                            found = true;

                            CookieCollection cc = (CookieCollection)entry.Value;
                            cc.TimeStamp(CookieCollection.Stamp.Set);
                            MergeUpdateCollections(cookies, cc, port, isSecure, matchOnlyPlainCookie);

                            if (path == "/")
                            {
                                defaultAdded = true;
                            }
                        }
                        else if (found)
                        {
                            break;
                        }
                    }
                }

                if (!defaultAdded)
                {
                    CookieCollection cc = (CookieCollection)pathList["/"];

                    if (cc != null)
                    {
                        cc.TimeStamp(CookieCollection.Stamp.Set);
                        MergeUpdateCollections(cookies, cc, port, isSecure, matchOnlyPlainCookie);
                    }
                }

                // Remove unused domain
                // (This is the only place that does domain removal)
                if (pathList.Count == 0)
                {
                    AddRemoveDomain(domainAttribute[i], null);
                }
            }
        }
All Usage Examples Of System.Net.CookieParser::CheckQuoted