Serialization problem when storing image in session while implementing sqlserver session state mode
I am implementing Session state to sql server mode in my web site and I am facing problem at this point
public void setCoverImage()
{
DateTime dt = new Da开发者_JAVA百科teTime();
int dd = dt.Day;
int mm = dt.Month;
int yy = dt.Year;
int hr = dt.Hour;
int min = dt.Minute;
int sec = dt.Second;
int msec = dt.Millisecond;
int tm = dd + mm + yy + hr + min + sec + msec;
imgShowLogo.Src = "../../supportfiles/epub/cover.jpg?state=[" + tm + "]";
//imgShowLogo.ImageUrl = "../../supportfiles/epub/cover.jpg?state=[" + tm + "]";
Session["BookLogo"] = imgShowLogo;
}
I am Facing problem here
"Unable to serialize the session state. In 'StateServer' and 'SQLServer' mode, ASP.NET will serialize the session state objects, and as a result non-serializable objects or MarshalByRef objects are not permitted. The same restriction applies if similar serialization is done by the custom session state store in 'Custom' mode. "
Please Help me ASAP and Thanks in advance.
Well, I think it would be enough to save only image url in session, not whole image.
精彩评论