- I have a webform that uses events in the master page to log activity.
- I have a sitemap.aspx file that generates proper XML for Google.
- The sitemap.aspx calls Response.End() to ensure the normal ASP.NET stuff (view state, master page content, etc) does not render. This XML must be exact.
- When I call Response.End() from the content page, none of the master page’s events fire.
Is there a way to tell the CLR to send exactly this string as the response, while allowing the Master page to continue its normal execution, and without having to decouple the ASPX from the Master page and call the logging methods manually?
There’s no pre-packaged way to do what you’re asking.
One approach might be to set a flag somewhere (maybe in
HttpContext.Items) after you write your string to the output buffer. Then, in your page class, override theRender()method; if the flag is not set, then callbase.Render(), otherwise don’t. By skippingRender(), no additional output will be generated.