1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Multi-site web.config values

Multi-site web.config values

5 posts, 0 answered
  1. Ivan
    Ivan avatar
    51 posts
    Registered:
    22 Aug 2007
    06 Nov 2009
    Link to this post
    Hi All,

    I have a multi-site configuration using the urlMapping option in the web.config.  I am using a single code base for all three sites that I am managing.  Is there a way to determine which site I am in, in order to use a particular appsetting value in the web.config?

    For example there is contact form that will need be sent to a different mailbox depending on the particular site that is being visited.  Is there a way built into Sitefinity's multi-site configuration to determine the current site and then select its respective mailbox value from the web.config?

    Thanks.
    -Ivan
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    09 Nov 2009
    Link to this post
    Hello Ivan,

    Generally you cannot have multiple smtp accounts in one web.confog file. You could try reading the web.config file and then parse the node and set SMTP settings. You can use MailSettingsSectionGroup. Another option is adding logic to your costom form that detects the current application and sets the mail settings. You can use publicly exposed properties that will allow you to set smtp data.

    Sincerely yours,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Ivan
    Ivan avatar
    51 posts
    Registered:
    22 Aug 2007
    09 Nov 2009
    Link to this post
    Hi Ivan,

    Thanks for your response.  I didn't mean the smtp server values but rather custom keys in the appSettings section such as a particular email address to use depending on the site that is currently accessed.

    So if I have a single Sitefinity instance that supports 3 separate sites: a.domain.com, b.domain.com and c.domain.com.  If I need a specific email address for each one, does Sitefinity provide a way for me to determine which one of the three domains is in context?  Does the urlMapping section in the web.config provide any help in this regard?  If not what is the recommended way to handle this scenario?

    Thanks.
    -Ivan
  4. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    10 Nov 2009
    Link to this post
    Hi,

    Unfortunately we haven't think of such situation, so there is no out of the box way.

    You can define a new (custom) section group / section name in the web.config file and store the e-mails there. Then it should be easy to retrieve these values with xpath whenever you need them.

    Greetings,
    Georgi
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  5. Ivan
    Ivan avatar
    51 posts
    Registered:
    22 Aug 2007
    10 Nov 2009
    Link to this post
    Thanks for the response Georgi.

    Since in this instance I am using a custom control, I have just set a public member that can be set via the control's properties in the editing area.

    I do think this would be a helpful feature for future versions though where the attribute can't be exposed as easily.

    Thanks again.
    -Ivan
Register for webinar
5 posts, 0 answered