Ejemplo n.º 1
0
        //- $SetViewStateObjects -//
        private static void SetViewStateObjects(DevServer.Service.Request request, Response response)
        {
            State stateTrees;

            if (!String.IsNullOrEmpty(request.Data))
            {
                stateTrees = ViewStateParser.ExtractViewStateTree(request.Data);
                if (stateTrees != null && (stateTrees.ControlState != null || stateTrees.ViewState != null))
                {
                    if (stateTrees.ControlState != null)
                    {
                        request.ControlState = stateTrees.ControlState.InnerXml;
                    }
                    if (stateTrees.ViewState != null)
                    {
                        request.ViewState = stateTrees.ViewState.InnerXml;
                    }
                }
            }
            //+
            if (!String.IsNullOrEmpty(response.Data))
            {
                stateTrees = ViewStateParser.ExtractViewStateTree(response.Data);
                if (stateTrees != null && (stateTrees.ControlState != null || stateTrees.ViewState != null))
                {
                    if (stateTrees.ControlState != null)
                    {
                        response.ControlState = stateTrees.ControlState.InnerXml;
                    }
                    if (stateTrees.ViewState != null)
                    {
                        response.ViewState = stateTrees.ViewState.InnerXml;
                    }
                }
            }
        }
Ejemplo n.º 2
0
        //- @SubmitRequest -//
        public static void SubmitRequest(String instanceId, HostConfiguration configuration, DevServer.Service.Request request, Response response)
        {
            if (configuration != null && configuration.EnableTracing)
            {
                using (RequestManagementClient client = new RequestManagementClient())
                {
                    String contentType = response.ContentType;
                    if (!String.IsNullOrEmpty(contentType))
                    {
                        Int32 i;
                        if ((i = contentType.IndexOf(";")) > -1)
                        {
                            contentType = contentType.Substring(0, i);
                        }
                    }
                    switch (contentType)
                    {
                    case ContentType.JavaScript:
                    case ContentType.XJavaScript:
                    case ContentType.Css:
                    case ContentType.Xml:
                    case ContentType.Html:
                    case ContentType.Text:
                    case ContentType.Xaml:
                    case ContentType.XHtml:
                    case ContentType.Json:
                    case ContentType.Soap:
                    case ContentType.Asx1:
                    case ContentType.Asx2:
                    case ContentType.Asx3:
                        break;

                    default:
                        if (!AllowContentTypeViaConfiguration(configuration.AllowedContentTypes, response.ContentType))
                        {
                            if (configuration.EnableVerboseTypeTracing)
                            {
                                response.Data = String.Empty;
                            }
                            else
                            {
                                return;
                            }
                        }
                        break;
                    }
                    try
                    {
                        SetViewStateObjects(request, response);
                    }
                    catch
                    {
                        //+ this feature isn't that important; we don't need it blowing up in the middle of our work.
                    }
                    //+ favicon Checking
                    if (request.Path.ToLower(System.Globalization.CultureInfo.CurrentCulture).EndsWith("favicon.ico") && !configuration.EnableFaviconTracing)
                    {
                        return;
                    }
                    //+
                    client.SubmitRequest(instanceId, request, response);
                }
            }
        }