//private static string ProcessRoleManager(RoleManagerSection roleManagerSection) //{ // if (roleManagerSection == null) // { // return null; // } // var result = new StringBuilder(); // result.AppendFormat("Domain:{0}{1}", roleManagerSection.Domain, NEWLINE); // result.AppendFormat("DefaultProvider:{0}{1}", roleManagerSection.DefaultProvider, NEWLINE); // result.AppendFormat("Enabled:{0}{1}", roleManagerSection.Enabled, NEWLINE); // result.AppendFormat("CookieName:{0}{1}", roleManagerSection.CookieName, NEWLINE); // result.AppendFormat("CookiePath:{0}{1}", roleManagerSection.CookiePath, NEWLINE); // result.AppendFormat("CacheRolesInCookie:{0}{1}", roleManagerSection.CacheRolesInCookie, NEWLINE); // result.AppendFormat("CookieProtection:{0}{1}", roleManagerSection.CookieProtection, NEWLINE); // result.AppendFormat("CookieRequireSSL:{0}{1}", roleManagerSection.CookieRequireSSL, NEWLINE); // result.AppendFormat("CookieSlidingExpiration:{0}{1}", roleManagerSection.CookieSlidingExpiration, NEWLINE); // result.AppendFormat("CookieTimeout:{0}{1}", roleManagerSection.CookieTimeout, NEWLINE); // result.AppendFormat("CreatePersistentCookie:{0}{1}", roleManagerSection.CreatePersistentCookie, NEWLINE); // result.AppendFormat("MaxCachedResults:{0}{1}", roleManagerSection.MaxCachedResults, NEWLINE); // var providerSection = roleManagerSection.Providers; // if (providerSection != null) // { // result.AppendFormat("Providers:{0}", NEWLINE); // foreach (ProviderSettings provider in providerSection) // { // result.AppendFormat("Name:{0} Type:{1} Parameters:{2}{3}", provider.Name, provider.Type, ProfilingSession.GetPairs(provider.Parameters), NEWLINE); // } // } // return result.ToString(); //} //private static string ProcessCustomErrors(CustomErrorsSection customErrorsSection) //{ // if (customErrorsSection == null) // { // return null; // } // var result = new StringBuilder(); // result.AppendFormat("Mode:{0}{1}", customErrorsSection.Mode.ToString(), NEWLINE); // result.AppendFormat("DefaultRedirect:{0}{1}", customErrorsSection.DefaultRedirect, NEWLINE); // result.AppendFormat("RedirectMode:{0}{1}", customErrorsSection.RedirectMode.ToString(), NEWLINE); // var errorsSection = customErrorsSection.Errors; // if (errorsSection != null) // { // result.AppendFormat("ErrorsSection:{0}", NEWLINE); // foreach (CustomError error in errorsSection) // { // result.AppendFormat("Redirect:{0} StatusCode{1}{2}", error.Redirect, error.StatusCode, NEWLINE); // } // } // return result.ToString(); //} //private static string ProcessAuthenticationSection(AuthenticationSection authenticationSection) //{ // if (authenticationSection == null) // { // return null; // } // var formsSection = authenticationSection.Forms; // var result = new StringBuilder(); // result.AppendFormat("Mode:{0}{1}", authenticationSection.Mode.ToString(), NEWLINE); // if (formsSection != null) // { // result.AppendFormat("Name:{0} Path:{1} Timeout:{2} Cookieless:{3} DefaultUrl:{4} Domain:{5} EnableCrossAppRedirects:{6} Protection:{7} RequireSSL:{8} SlidingExpiration:{9} TicketCompatibilityMode:{10}", formsSection.Name, formsSection.Path, formsSection.Timeout, formsSection.Cookieless, // formsSection.DefaultUrl, formsSection.Domain, formsSection.EnableCrossAppRedirects, formsSection.Protection, formsSection.RequireSSL, // formsSection.SlidingExpiration, formsSection.TicketCompatibilityMode); // result.AppendFormat("{0}", NEWLINE); // result.AppendFormat("Credentials:{0}", NEWLINE); // var credentialsSection = formsSection.Credentials; // if (credentialsSection != null) // { // result.AppendFormat("PasswordFormat:{0}{1}", credentialsSection.PasswordFormat.ToString(), NEWLINE); // } // } // return result.ToString(); //} //private static string ProcessHttpModules(HttpModulesSection httpModulesSection) //{ // if (httpModulesSection == null) // { // return ""; // } // var result = new StringBuilder(); // foreach (HttpModuleAction httpModule in httpModulesSection.Modules) // { // result.AppendFormat("{0}:{1}{2}", httpModule.Name, httpModule.Type, NEWLINE); // } // return result.ToString(); //} //private static string ProcessHttpHandler(HttpHandlersSection httpHandlersSection) //{ // if (httpHandlersSection == null) // { // return null; // } // var result = new StringBuilder(); // foreach (HttpHandlerAction httpModule in httpHandlersSection.Handlers) // { // result.AppendFormat("Path:{0} Type:{1} Verb:{2} Validate:{3}{4}", httpModule.Path, httpModule.Type, httpModule.Verb, httpModule.Validate, NEWLINE); // } // return result.ToString(); //} #endregion public static string GetRespnoseBody(HttpContext context) { var response = context.Response; // string HeaderEncoding = response.HeaderEncoding.ToString(); // string ContentEncoding = response.ContentEncoding.ToString(); string StatusCode = response.StatusCode.ToString(); string ContentType = response.ContentType; //string Charset = response.Charset; NameValueCollection _propertyVariables = new NameValueCollection(); // _propertyVariables.Add("ContentEncoding", ContentEncoding); _propertyVariables.Add("StatusCode", StatusCode); _propertyVariables.Add("ContentType", ContentType); // _propertyVariables.Add("Charset", Charset); string ouputText = "";// Pure.Profiler.Web.Proxy.HttpContextProxy.GetResponseText(response); //using (var sr = new StreamReader(response.OutputStream, System.Text.Encoding.Default)) //{ // ouputText = sr.ReadToEnd(); // sr.Close(); //} NameValueCollection _cookies = null; NameValueCollection _requestHeaders; //try //{ // _cookies = new NameValueCollection(response.Cookies.Count); // for (var i = 0; i < response.Cookies.Count; i++) // { // var name = response.Cookies[i].Name; // _cookies.Add(name, response.Cookies[i].Value); // } //} //catch (Exception e) //{ // //Trace.WriteLine("Error parsing cookie collection: " + e.Message); //} _requestHeaders = new NameValueCollection(response.Headers.Count); foreach (var header in response.Headers.Keys) { // Cookies are handled above, no need to repeat if (string.Compare(header, "Cookie", StringComparison.OrdinalIgnoreCase) == 0) { continue; } if (response.Headers[header] != StringValues.Empty) { _requestHeaders[header] = response.Headers[header]; } } return(string.Format("<b>{0}</b>{5}<b>RequestHeaders</b>{5} {1}{5}<b>Cookies</b>{5} {2}{5}{5}{3}{5} ", ProfilingSession.GetPairs(_propertyVariables).ToString(), ProfilingSession.GetPairs(_requestHeaders).ToString(), ProfilingSession.GetPairs(_cookies).ToString(), ouputText, "", NEWLINE)); }