title: Glass Mapper SitecoreInfo.Url not working as expected on multisite
body: <p>I have an issue with mapping SitecoreInfoType.Url on a  sitecore multisite solution.</p>
  
  <p>I have in sitecore 2 websites:</p>
  
  <ul>
  <li>Site A</li>
  <li>Site B</li>
  </ul>
  
  <p>Site A contains some articles: </p>
  
  <ul>
  <li>www.Site-A/Articles/Article 1</li>
  <li>www.Site-A/Articles/Article 2</li>
  </ul>
  
  <p>On our main "Article landing page", we have a widget that shows a short description of each article with links to article page.</p>
  
  <p>for using the url, we are mapping it with SitecoreInfoType.Url</p>
  
  <p>e.g.</p>
  
  
  
  <pre class="lang-cs prettyprint-override"><code>    [SitecoreInfo(SitecoreInfoType.Url)]
      public virtual string Url { get; set; }
  </code></pre>
  
  <p>This is rendered correctly as it is used on Site A, we get dynamic urls like /en/Articles/{Article Name}.</p>
  
  <p>If we try to use the widget on Site B, the url is not generated as expected: </p>
  
  <ul>
  <li>/en/sitecore/content/Site A/Home/Articles/{Article Name}</li>
  </ul>
  
  <p>We already have implemented on website Sitecore fields of Link type and we are using UrlOptions for solving this kind of behaviour.</p>
  
  <p>e.g.</p>
  
  <pre class="lang-cs prettyprint-override"><code>    [SitecoreField(UrlOptions = SitecoreInfoUrlOptions.SiteResolving)]
      public virtual Link AlternateLink { get; set; }
  </code></pre>
  
  <p>This will generate the expected result. If we are trying to generate a Link for a target item that is under other website, domain will be used for generating url.</p>
  
  <ul>
  <li>Target item is under Site A.</li>
  <li>Widget is used on Site B and context is set to Site B</li>
  <li>Link Url is generated like: www.Site-A/Articles/{Target item}</li>
  </ul>
  
  <p>Unfortunately glass mapper is not mapping in the same way SitecoreField and SitecoreInfoType.Url.</p>
  
  <p>Update on code:</p>
  
  <pre class="lang-cs prettyprint-override"><code>    [SitecoreInfo(SitecoreInfoType.Url, UrlOptions = SitecoreInfoUrlOptions.SiteResolving)]
      public virtual string Url { get; set; }
  </code></pre>
  
  <p>And in similar context:</p>
  
  <ul>
  <li>Target item is under Site A.</li>
  <li>Widget is used on Site B and context is set to Site B</li>
  <li>Link Url is generated like: /en/sitecore/content/Site A/Home/Articles/{Target item}</li>
  </ul>
  
  <p>Note: </p>
  
  <ul>
  <li>Other UrlOptions used on SitecoreInfoType.Url are working:</li>
  </ul>
  
  <p><em>SitecoreInfoUrlOptions.AddAspxExtension</em></p>
  
  <p><em>SitecoreInfoUrlOptions.AlwaysIncludeServerUrl</em></p>
  
  <p><em>SitecoreInfoUrlOptions.LanguageEmbeddingNever</em></p>
  
  <p>In case of using SitecoreInfoUrlOptions.AlwaysIncludeServerUrl the result is strange: www.Site B/en/sitecore/content/Site A/Home/Articles/{Target item}</p>
  
  <p>For me it seems that this is a bug in glass mapper library.</p>
  
  <p>Anyone had this issue and a fix or workaround?
  I would prefer to not use Sitecore API and try to get the item and use LinkManager again as this is already used in glass mapper implementation.</p>
  
  <p>Here is my site definition config:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;sites&gt;
      &lt;site name="siteA"
         patch:before="site[@name='website']"
         hostName="siteA.domain.com"
         targetHostName="siteA.domain.com"
         virtualFolder="/"
         physicalFolder="/"
         rootPath="/sitecore/content/domain/siteA"
         startItem="/Home"
         database="web"
         domain="extranet"
         allowDebug="true"
         cacheHtml="true"
         htmlCacheSize="50MB"
         enablePreview="true"
         enableWebEdit="true"
         enableDebugger="true"
         disableClientData="false"
         scheme="http"
         /&gt;
    &lt;site name="siteB"
          patch:before="site[@name='website']"
          hostName="siteB.domain.com"
          targetHostName="siteB.domain.com"
          virtualFolder="/"
          physicalFolder="/"
          rootPath="/sitecore/content/domain/siteB"
          startItem="/Home"
          database="web"
          domain="extranet"
          allowDebug="true"
          cacheHtml="true"
          htmlCacheSize="50MB"
          enablePreview="true"
          enableWebEdit="true"
          enableDebugger="true"
          disableClientData="false"
          scheme="http"
          /&gt;
  &lt;/sites&gt;
  </code></pre>