Question

We have more or less the following infrastructure 1. In production we have WFE, App Serv, UAG. We have some configuration to point internet URLs to sites on THE dmz production farm. Something like www.mydomain.com will go to http://server1 or whatever.

  1. In testing environment we have the same config,

  2. However in dev environment we dont have an UAG servers but we do have alternate access mappings. So, one site like http://devenvironment.ourdomain.com actually goes to http://devserver The dns admin created dns records to be able to see that URL from the workstation or from the development server itself, which by the way has visual studio installed.

In sharepoint, many times you need to interact with SPWeb and SPSite objects, and in the constructor sometimes you have to use the URL, so:

  1. I suppose the AAM Url wont work?
  2. Should I use always the real internal url aka Server name?
  3. What approach would you recommend to develop in this environment specially when I will heavely use Spweb and Spsite objects?
Was it helpful?

Solution

You should not hardcode a URL into your code. In most cases you can access the context your component is in and can therefore access the objects without a specific hardcoded URL. If you are writing a program that runs outside of SharePoint, and therefore the context must be provided, you should add a configuration section/file of some sort to allow you to change this on the fly.

Without knowing more details of what you are actually coding (web part, feature, workflow action, etc.) I can't be any more specific than that.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top