Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have quite a few custom webparts that redirect the user to specific content. It all works fine in HTTP context, but not in HTTPS, because I can't manage to get the S using SPContext.Current.Site.MakeFullUrl. I always get the unsecure protocol even if I'm acessing via https.

Since the content is usually displayed in the ModalDialog, it keeps on the "loading..." forever.

share|improve this question

2 Answers 2

If you are trying to refer to assets (scripts, images, stylesheets, etc.) that are available on both http and https you could use scheme-relative urls (//).

For example:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>

This will also work for assets located on your local SharePoint server, given you can access them with both protocols.

share|improve this answer
    
well... its part of the problem... (+1) but the main issue is redirecting to pages programatically... the url always come back http... –  Leonardo Nov 6 '12 at 19:59
1  
Can you not redirect using a relative URL? –  Robert Kaucher Nov 6 '12 at 20:16
    
no. In order to Modal dialog works you have to provide wither a html or a url for it... and the url cannot be relative... my case is kinda special because the content might not be in the same site-collection or even the same farm (we have a diferent farm for search, for example) –  Leonardo Nov 6 '12 at 21:50
    
If your farms have different hosts or ports then using OpenPopUpPage will still break Same Origin Policy, because of the iframe it uses. –  eirikb Nov 6 '12 at 22:06

Do you need to use MakeFullUrl for some reason? You can use HTTPContext.Current.Request.Url to build your site's relative URL like so:

String RelURL = HttpContext.Current.Request.Url.Scheme.ToString() + "://" + HttpContext.Current.Request.Url.Host.ToString();
share|improve this answer
    
Yes. In order to Modal dialog work, you have to provide either a html or a url for it... and the url cannot be relative... my case is kinda special because the content might not be in the same site-collection or even the same farm (we have a diferent farm for search, for example)... another error happens because of the multiple AAM... sharepoint mixes them up... so yes i have to use MakeFullUrl... –  Leonardo Nov 6 '12 at 21:53

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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