Locating the site through code

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
10/8/2013 9:45:14 AM
Gravatar
Total Posts 20

Locating the site through code

If you have multiple sites and you want to identify the number of the site or folder through code, how to proceed?

10/8/2013 10:20:58 AM
Gravatar
Total Posts 1203
Proud member of the mojoPortal team

Help support mojoPortal!
Add-on modules

Re: Locating the site through code

I don't know the technique off the top of my head, but as with most everything in mojoPortal, the code itself is the best teacher. Take a look at SiteList.aspx.cs (code behind for the /Admin/SiteList.aspx page).

10/8/2013 11:43:59 AM
Gravatar
Total Posts 18439

Re: Locating the site through code

For code that runs in the context of a web page request you can do:

SiteSettings siteSettings = CacheHelper.GetCurrentSiteSettings();​

then you can use 

siteSettings.SiteID to get the id of the current site.

10/8/2013 2:58:29 PM
Gravatar
Total Posts 20

Re: Locating the site through code

Ottimo grazie!

Funziona perfettamente.

 

You must sign in to post in the forums. This thread is closed to new posts.