I need to change the method of using viewstate depending on whether the end user is on a mobile device. Changing the viewstate persistence location is working fine using the following script contained within the pages head section:
<script runat="server">
protected override object LoadPageStateFromPersistenceMedium()
{
return Session["_ViewState"];
}
protected override void SavePageStateToPersistenceMedium(object viewState)
{
Session["_ViewState"] = viewState;
}
</script>
What I need to do is make this script execution conditional upon whether the end user is using a mobile. There are many examples on how to detect whether it is a mobile or not but how do I make the above script section conditional upon the detection script's result?