Question: Is there a way to detect what XHtml conformance setting a particular ASP.Net web page is being generated using at run time (without reference to the web.config).
Background: We have ASP.NET web pages which need to work under different XHtml Conformance modes - mostly Legacy (Sorry Mum), but some which use Transitional to enable AJAX Update Panels etc. to function correctly.
We are using location tags in the web config to override the conformance mode for individual web pages.
<system.web>
<xhtmlConformance mode="Transitional" />
</system.web>
But we came across an issue, where upon the first display the web page - none of links or buttons worked correctly - the first button click was always ignored, but any subsequent clicks were okay.
Have traced this to doing a Server.Transfer from a Legacy Web Page to the Transition Web Page - I assume the transitional page wasn't actually rendered as Transition and therefore the first postback wasn't in the correct format and the web server went "not like that, like this!". I assume similar issues may exist when Server Transferring from Transition pages back into Legacy pages.
Response redirects do work ok, but unfortunately Server Transfers are commonly used within our application and some of the transfers are using data exchange from the previous page - which makes a blanket replacements of server transfers impossible.
So I am looking into whether we can automatically and generically force an extra postback or maybe a redirect on initial display when we are found to be being rendered in the wrong mode (assuming that is the issue). But am needing to detect what mode we are being rendered in - and asking the config would always come up with the same answer that in this case may not necessarily be the right answer.
Cheers if anyone can help.