I guess I have two parts to this question,
I have a company logo, which is saved as a byte array in my database. I want to load the Byte array (logo) into the cookie as I want to display the logo on my _layout pages.
So is this a good approach? if not want other option(with example) could I use (the storage of the image is not up for debate)?
If what I am doing is a good approach, Im having issues displaying my logo as i'm guessing its to do with the conversion of byte array to string and then back again?
Cookie
public UserToken(string rawToken)
{
string[] parts = rawToken.Split('/');
_userId = parts[0];
_logo = Encoding.ASCII.GetBytes(parts[1]); //I believe this encoding is wrong?
}
_Layout page
@{var usertoken = new UserToken(ViewContext.HttpContext.User.Identity.Name)};
..
<img src="data:image;base64,@System.Convert.ToBase64String(usertoken.Logo)" width="80" height="40"/>
Thanks in advance.
