The problem is that I can't find a way to test anything stored in AppState["variableName"] (or App.variableName or HttpContext.Current.Application["variableName"], etc.) inside an if condition. (It only ever sees it as an object, even though I can plot it on the page with Razor as the string variable I thought it was)
So, I can't compare them to say an actual string value.
I've tried ToString(), among countless other attempts, to no avail.
My question is: How can I achieve full functionality with the AppState variable in WebMatrix Web-Pages with C#?
The problem here is that casting is needed, without a space between the cast and the AppState variable. At the time that I posted this question, I was still so new (well, still am really) to C# server side programming. An example of what works is:
if ((string)AppState["myVariable"] == "someString")
{
//do some stuff
}
Also, whether many people like the term "global variable" or not, the AppState variable is, in fact, considered a global variable. This is clearly stated in Mike Brind's Mikesdotnetting article "Tranferring Data Between ASP.NET Web Pages" in the very first line under Application Variables:
"Application variables are also known as global variables." --(Mikesdotnetting)
Also, if you (whoever you are) have not read this article and are either new to WebMatrix or want to see all of the options for transferring data between pages in WebMatrix, please do yourself a tremendous favor and read this easy-to-read, well-written, and highly educational article found here:
http://www.mikesdotnetting.com/Article/192/Transferring-Data-Between-ASP.NET-Web-Pages