Skip to content

Instantly share code, notes, and snippets.

@johndavedecano
Created January 31, 2014 01:31
Show Gist options
  • Save johndavedecano/8725034 to your computer and use it in GitHub Desktop.
Save johndavedecano/8725034 to your computer and use it in GitHub Desktop.
Simple Flash Message with C#
using System;
using System.Web;
namespace CMSApplication
{
public class FlashMessage : System.Web.UI.Page
{
public void put(string key,string message = "")
{
Session[key] = message;
}
public string get(string key)
{
if(Session[key] == null)
{
return "";
}else{
string message = Session[key].ToString();
Session.Remove(key);
return message;
}
}
public bool has(string key)
{
if(Session[key] == null)
{
return false;
}else{
return true;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment