0

I need to determine the 'main' server name based on the My Site server name in a control. This control needs to work in multiple environments with a different set of servers in each.

Example: My Site URL: http://My-Dev 'Main' site URL: http://Dev

What I (think I) need to do is to get the My Site server name (My-Dev in the example), test it, and come up with the corresponding main server name.

I'm sure I could write a RegExp against the URL but it seems to me I've seen the Server property of some SP object somewhere before.

  • I think like Dave asks Main Server doesn't always apply in many SharePoint instances, such as a Farm environment where there may be a Central Admin and multiple Web Front Ends. Main Server in that context doesn't make much sense. – MichaelF Jul 15 '11 at 18:10
1

Check SPServer.Local property. http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.administration.spserver_members.aspx

0

There is no 'main' web application for a MySite because a single MySite can be used by multiple web applications. If you know that you will always have one and only one 'main' web app associated with your MySite then it would probably be better to define an AppSetting in the web.config of the MySite and reference it via ConfigurationManager.AppSettings. There are certainly other options but that is the simplest.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.