Can arrays be stored in an ASP.NET profile?

Imagine an ASP.NET website that displays stock prices when a user logs in. Can I save a list of caption characters in an ASP.NET profile? I only see how to add strings, etc., and not collections such as lists or arrays.

+3
source share
2 answers

To avoid over-engineered for this specific case, you can just make "MSFT|AAPL|ETC"and string.Split('|')value. string.Join("|", values)for storage.

If you are faced with a situation where you need an object graph that is really complex, you can do :

<profile defaultProvider="AspNetSqlProfileProvider">
  <properties>
    <add name="FavoriteURLs" 
      type="System.Collection.Specialized.StringCollection"
      serializeAs="Xml" />
  </properties>
</profile>

, , "type", XML.

+6

Source: https://habr.com/ru/post/1717490/


All Articles