So here is the round about way I ended up doing it. I just don't know if it is the best practice or not. Based off the comments I specify what session items I want to send to angular.
1) I created a unique dictionary that is going to pass the data to my session variable
private Dictionary<string, List<string>> _sessionDict
= new Dictionary<string, List<string>>();
2) I created a fn() to help speed up the insert process
public static void addDictionarySession(
Dictionary<string, List<string>> sessionDict, string key, string value)
{
List<string> stringValue = new List<string>() { value };
sessionDict.Add(key, stringValue);
}
3) I inserted the data into my dictionary
utility.addDictionarySession(_sessionDict, "test", "This is a test");
4) I added the dictionary to the session
Session.Add("jsPass", _sessionDict);
5) I created an ashx handler page to get the session variables here is my function
private void getSessionVariables()
{
Dictionary<string, string> sessionData = new Dictionary<string, string>();
// Retrieve Session that is stored in dictionary
Dictionary<string, List<string>> sessionDict =
_context.Session["jsPass"] as Dictionary<string, List<string>>;
if (sessionDict != null)
{
foreach (KeyValuePair<string, List<string>> entry in sessionDict)
{
// Set the Value of the item
foreach (string value in entry.Value)
{
sessionData.Add(entry.Key, value.ToString());
}
}
}
// _context is just my private HttpContext variable I set at the beginning of the class
utility.httpContentWrite(_context, sessionData);
}
5) I created an angular service that fetches an ashx handler page
// Load Session
getSession: function () {
return $http.get('../../handlers/getSessionData.ashx');
}
6) I created an angular controller function to call the service and pull the item into a $scope variable, I set the function to a variable then executed the function call
var setSession = function () {
UtilityService.getSession().success(
function (results) {
$scope.session = results;
});
};
setSession();
7) I can now access my variable
{{session.test}}
8) You can view all the items you have set using this
<div ng-repeat="(key, value) in session">
<span>{{key}} : {{value}}</span>
</div>
9) I was able to get the session into scope here