Пример #1
0
        /// <summary>
        /// This processes the incoming headers and adds them to the Controller Request.
        /// </summary>
        /// <param name="contRQ"></param>
        /// <param name="rq"></param>
        protected virtual void HeadersProcess(SiteControllerContext context, ControllerRequest contRQ, HTTPRequestMessage rq)
        {
            string isoCode;
            if (mSClogger != null &&
                mSClogger.ResolveAddress(contRQ.RequestAddressRemote.Address, out isoCode))
            {
                contRQ.RequestAddressRemoteResolvedCountryCode = isoCode;
            }

            foreach (HeaderFragment frag in rq.HeaderFragments())
            {
                switch (frag.Field.ToLower())
                {
                    case "x-wap-profile":
                        contRQ.RequestUserAgentWapProfile = frag.FieldData;
                        break;
                    case "if-none-match":
                        contRQ.RequestIfNoneMatch = frag.FieldData;
                        break;
                    case "connection":
                        contRQ.RequestConnection = frag.FieldData;
                        break;
                    case "accept":
                        contRQ.RequestAccept = frag.FieldData;
                        break;
                    case "accept-language":
                        contRQ.RequestAcceptLanguage = frag.FieldData;
                        break;
                    case "accept-encoding":
                        contRQ.RequestAcceptEncoding = frag.FieldData;
                        break;
                    case "accept-charset":
                        contRQ.RequestAcceptCharset = frag.FieldData;
                        break;
                    case "user-agent":
                        contRQ.RequestUserAgent = frag.FieldData;
                        break;
                    case "referer":
                        contRQ.RequestRefererURI = frag.FieldData;
                        break;
                    case "authorization":
                        contRQ.RequestAuthorization = frag.FieldData;
                        break;
                    case "content-type":
                        contRQ.RequestContentType = frag.FieldData;
                        break;
                    case "content-length":
                        contRQ.RequestContentLength = frag.FieldData;
                        break;
                    case "content-encoding":
                        contRQ.RequestContentEncoding = frag.FieldData;

                        break;
                    case "host":
                        break;

                    default:
                        contRQ.RequestHeaderAdd(frag.Field, frag.FieldData);
                        break;
                }
            }
        }
Пример #2
0
 /// <summary>
 /// This method resets the request so that it can be reused.
 /// </summary>
 public override void Reset()
 {
     mData = null;
     mSettings = null;
     base.Reset();
 }
Пример #3
0
        /// <summary>
        /// This method sets the authentication for a stored cookie credentials.
        /// </summary>
        /// <param name="context">The current context.</param>
        /// <param name="cookieMember">The member cookie.</param>
        protected virtual void ProcessMemberCookie(SiteControllerContext context, ControllerRequest.Cookie cookieMember)
        {
            string[] members = cookieMember.Value.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);

            foreach (string item in members)
            {
                ProcessMemberCookieItem(context, item);
            }
        }