Link to home
Start Free TrialLog in
Avatar of Star79
Star79Flag for United States of America

asked on

Code snippet to write the httpresponse and httprequest object to a text file

I need to troubleshoot a issue with session getting abandoned.  In the following c# code, I need to write a the detailed httprequest and httpresponse in a text file to analyze further. One of the reason why I want to do this is to identify from which procedure the request was made which is causing the session to abandon. Sample code is given below. Any help will be highly appreciated.

  void Application_PostRequestHandlerExecute(object sender, EventArgs e)
        {
            HttpApplication app = (HttpApplication)sender;
            HttpRequest req = app.Request;
            HttpResponse resp = app.Response;

            ///Code to capture the httprequest and httpresponse.

             if (!ValidateRequest(req, resp))
            {
                FormsAuthentication.SignOut();
                Session.Abandon();
                resp.Redirect(loginVPath, true);
            }
            }
        }
ASKER CERTIFIED SOLUTION
Avatar of Miguel Oz
Miguel Oz
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial