Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Text;
- using System.Web;
- using System.IO;
- namespace Core.Web {
- public static class SessionHelper {
- public static T GetValue<T>(this HttpSessionStateBase session,string name,T valueIfNull = default(T)) {
- object raw = session[name];
- if(raw == null)
- return valueIfNull;
- T value = (T)raw;
- if(value == null)
- return valueIfNull;
- return value;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment