Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Application Settings in Web projects

Application Settings in Web projects

Scheduled Pinned Locked Moved ASP.NET
tutorialquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mohammad A Gdeisat
    wrote on last edited by
    #1

    Hi, I want to make my website configurable so I want to include some settings somewhere (maybe in web.Config file), when I was reading about this topic I found that Windows Form Apps can have "Application Settings" file in which you can visually create and remove user scope and application scope settings, which seems to be an easier way to make a project configurable, but I noticed that I can't store whatever objects I want, for example I can't store List object, and I don't know if this type of settings is applicable to web applications. In short, I want to know the best way to make a Web Project Configurable in terms of: 1. It is easy (and not time consuming) to add/remove settings. 2. It can store custom objects for example: MyCustomClass. Any Ideas? Thanks alot

    And ever has it been that love knows not its own depth until the hour of separation Mohammad Gdeisat

    N L 2 Replies Last reply
    0
    • M Mohammad A Gdeisat

      Hi, I want to make my website configurable so I want to include some settings somewhere (maybe in web.Config file), when I was reading about this topic I found that Windows Form Apps can have "Application Settings" file in which you can visually create and remove user scope and application scope settings, which seems to be an easier way to make a project configurable, but I noticed that I can't store whatever objects I want, for example I can't store List object, and I don't know if this type of settings is applicable to web applications. In short, I want to know the best way to make a Web Project Configurable in terms of: 1. It is easy (and not time consuming) to add/remove settings. 2. It can store custom objects for example: MyCustomClass. Any Ideas? Thanks alot

      And ever has it been that love knows not its own depth until the hour of separation Mohammad Gdeisat

      N Offline
      N Offline
      N a v a n e e t h
      wrote on last edited by
      #2

      Mohammad A Gdeisat wrote:

      It is easy (and not time consuming) to add/remove settings.

      Put it in custom configuration files. Write classes for reading and writing to these files. For primitive values, you should be able to open this config file manually and edit the required settings.

      Mohammad A Gdeisat wrote:

      It can store custom objects for example: MyCustomClass.

      This also can be kept on XML files. You need to serialize the custom type's object and encode to Base64. Problem with this approach is you need to create some user interface to manage this and can't be edited by opening the file directly.

      Mohammad A Gdeisat wrote:

      I can't store List object, and I don't know if this type of settings is applicable to web applications.

      As I said, it can be serialized and stored. But I will not suggest keeping custom types in configuration files as serialized. Because you can't manage it easily. Recommended approach is to keep values which can be used to create the custom type. Read this values and create your type and if it is used frequently and not user specific, cache it. To explain my point, assume you have to keep details of people who are administrators of the site. You can keep your configuration entries like

      <administrators>
      <administrator>
      <name>name1</name>
      <role>somerole</role>
      </administrator>
      <administrator>
      <name>name2</name>
      <role>somerole</role>
      </administrator>
      </administrators>

      You need to create a type for administrator with necessary properties. Read these details from this configuration and fill your custom types. Cache it in static variables or ASP.NET cache object for future use. XML serialization also works well. Hope this helps :)

      Navaneeth How to use google | Ask smart questions

      M 1 Reply Last reply
      0
      • M Mohammad A Gdeisat

        Hi, I want to make my website configurable so I want to include some settings somewhere (maybe in web.Config file), when I was reading about this topic I found that Windows Form Apps can have "Application Settings" file in which you can visually create and remove user scope and application scope settings, which seems to be an easier way to make a project configurable, but I noticed that I can't store whatever objects I want, for example I can't store List object, and I don't know if this type of settings is applicable to web applications. In short, I want to know the best way to make a Web Project Configurable in terms of: 1. It is easy (and not time consuming) to add/remove settings. 2. It can store custom objects for example: MyCustomClass. Any Ideas? Thanks alot

        And ever has it been that love knows not its own depth until the hour of separation Mohammad Gdeisat

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        If you want to use global setting for website then Opt for Application Variables.

        1 Reply Last reply
        0
        • N N a v a n e e t h

          Mohammad A Gdeisat wrote:

          It is easy (and not time consuming) to add/remove settings.

          Put it in custom configuration files. Write classes for reading and writing to these files. For primitive values, you should be able to open this config file manually and edit the required settings.

          Mohammad A Gdeisat wrote:

          It can store custom objects for example: MyCustomClass.

          This also can be kept on XML files. You need to serialize the custom type's object and encode to Base64. Problem with this approach is you need to create some user interface to manage this and can't be edited by opening the file directly.

          Mohammad A Gdeisat wrote:

          I can't store List object, and I don't know if this type of settings is applicable to web applications.

          As I said, it can be serialized and stored. But I will not suggest keeping custom types in configuration files as serialized. Because you can't manage it easily. Recommended approach is to keep values which can be used to create the custom type. Read this values and create your type and if it is used frequently and not user specific, cache it. To explain my point, assume you have to keep details of people who are administrators of the site. You can keep your configuration entries like

          <administrators>
          <administrator>
          <name>name1</name>
          <role>somerole</role>
          </administrator>
          <administrator>
          <name>name2</name>
          <role>somerole</role>
          </administrator>
          </administrators>

          You need to create a type for administrator with necessary properties. Read these details from this configuration and fill your custom types. Cache it in static variables or ASP.NET cache object for future use. XML serialization also works well. Hope this helps :)

          Navaneeth How to use google | Ask smart questions

          M Offline
          M Offline
          Mohammad A Gdeisat
          wrote on last edited by
          #4

          Yes, this definitely gives a better view :) Thanks for your time :)

          And ever has it been that love knows not its own depth until the hour of separation Mohammad Gdeisat

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups