Looks like context parameter of asp:net substitution control method is missing the current session once the page is output cached.
Aside from getting the substitution control's content thru ajax or using some other method to store data that would otherwise be in session (like database) is there anything else I can do?
Is there a workaround to use native asp.net session in substitution control?
<asp:Substitution ID="myid" MethodName="method1"></asp:Substitution>
public static string method1(HttpContext context) <-- [1]
[1] --- conext.session is null after page is cached
What happens if you ensure that context.Session isn't null before accessing the value? I've had session problems before, not when using the Substitution control though, because Context.Session isn't set for the first request a user makes. You may be having a related problem as it wouldn't sit in the standard page lifecycle.
According to ScottGu everything should be available.
Tip/Trick: Implement "Donut Caching" with the ASP.NET 2.0 Output Cache Substitution Feature