locked
Resource File vs Web.Config RRS feed

  • Question

  • Hi,

    I have developed a custom web part in SharePoint 2010.  I need to use third party URLs to communicate with other vendor sites from the custom web part.  Now, the question is :  Do I need to maintain the URL entries in Resource file or web.config file, which one is a good programming approach to follow and give me the reasons.

    Thanks

    Kiran

    Sunday, March 11, 2012 2:31 PM

Answers

  • Better approach would be create a custom List  and  put  third party URLs to communicate with other vendor sites .so you can manage properly . get the values from list use it where ever you want.

    http://msdn.microsoft.com/en-us/library/ff521580.aspx

    Resource files are basically for used if the site is multilingual i.e. if you want to show the same content in different languages.

    please check here:

    http://blogs.msdn.com/b/johnwpowell/archive/2009/11/29/sharepoint-2010-localization-with-visual-studio-2010.aspx

    you can add those to web.config file but if you want to change those frequently it will be a problem.


    MCTS,MCPD Sharepoint 2010. My Blog- http://sharepoint-journey.com


    If a post answers your question, please click "Mark As Answer" on that post and "Vote as Helpful


    Sunday, March 11, 2012 2:42 PM
  • Resource files are for language/culture dependent information. So if the URLs varies based on culture then it might make sense to store them there.

    Where to store the URLs depends on who will be editing the URLs

    • If they are farm wide, rarely edited, and the are only edited by server admins, then put them in web.config
    • If they are edited by the site collection admin or a site owner and are the same for multiple instances of the web part used in multiple pages and sites, then store the URLs in a SharePoint list (maybe at the top level site)
      or, it they need to be stored at the site collection level, but not visible via a list, also take a look at using SharePoint Property Bags.
    • If they are unique to each instance of the web part then store them in the web part's properties.


    Mike Smith TechTrainingNotes.blogspot.com

    • Marked as answer by Shimin Huang Friday, March 23, 2012 6:00 AM
    Sunday, March 11, 2012 4:44 PM

All replies

  • Better approach would be create a custom List  and  put  third party URLs to communicate with other vendor sites .so you can manage properly . get the values from list use it where ever you want.

    http://msdn.microsoft.com/en-us/library/ff521580.aspx

    Resource files are basically for used if the site is multilingual i.e. if you want to show the same content in different languages.

    please check here:

    http://blogs.msdn.com/b/johnwpowell/archive/2009/11/29/sharepoint-2010-localization-with-visual-studio-2010.aspx

    you can add those to web.config file but if you want to change those frequently it will be a problem.


    MCTS,MCPD Sharepoint 2010. My Blog- http://sharepoint-journey.com


    If a post answers your question, please click "Mark As Answer" on that post and "Vote as Helpful


    Sunday, March 11, 2012 2:42 PM
  • Resource files are for language/culture dependent information. So if the URLs varies based on culture then it might make sense to store them there.

    Where to store the URLs depends on who will be editing the URLs

    • If they are farm wide, rarely edited, and the are only edited by server admins, then put them in web.config
    • If they are edited by the site collection admin or a site owner and are the same for multiple instances of the web part used in multiple pages and sites, then store the URLs in a SharePoint list (maybe at the top level site)
      or, it they need to be stored at the site collection level, but not visible via a list, also take a look at using SharePoint Property Bags.
    • If they are unique to each instance of the web part then store them in the web part's properties.


    Mike Smith TechTrainingNotes.blogspot.com

    • Marked as answer by Shimin Huang Friday, March 23, 2012 6:00 AM
    Sunday, March 11, 2012 4:44 PM