locked
Current.Session XmlException RRS feed

  • Question

  • System.Web.HttpContext.Current.Session[key] = sValue;

    XmlException There are multiple root elements. Line 1, position 330.


    Bernard Lessard

    Wednesday, December 12, 2012 4:19 AM

Answers

  • Hello,

    You have to understand that when you store data in a session object, the .net framework serializes the value before storing and by default the format is Xml. Now, apparently the "key" or the "sValue" are not in the valid xml format or there's problem in serializing the sValue object. Please check the "key" or "sValue" values for which this exception is thrown and handle the values accordingly!

    Thanks


    Akshaya K Sharma

    Monday, December 17, 2012 11:40 AM

All replies

  • Hi bernybon,

    What function do you want to achieve, and could you please try to provide more code to us?

    Thanks,
    Amy Peng


    Amy Peng
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, December 13, 2012 6:28 AM
    Moderator
  • Hello,

    You have to understand that when you store data in a session object, the .net framework serializes the value before storing and by default the format is Xml. Now, apparently the "key" or the "sValue" are not in the valid xml format or there's problem in serializing the sValue object. Please check the "key" or "sValue" values for which this exception is thrown and handle the values accordingly!

    Thanks


    Akshaya K Sharma

    Monday, December 17, 2012 11:40 AM