Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a website that is using Windows Server 2003. The site is called https://mysite.com/ and at ip address 111.1.1.1. Now when I log into the site all my relative links that are generated using NavURL (<%# NavURL("Images/Menu/img.gif")%>) are saying "http://111.1.1.1/Images/Menu/img.gif" instead of "https://mysite.com/Images/Menu/img.gif". This is causing an error because it needs to be secure. I'm sure there is a setting on the server somewhere to point to the name and not the ip, but I don't know where. Thanks for your help.

share|improve this question

migrated from stackoverflow.com Mar 17 '10 at 2:47

This question came from our site for professional and enthusiast programmers.

    
What is NavURL? –  Jørn Schou-Rode Mar 16 '10 at 20:54
    
Why so uninformative title? –  Dmitry Mar 16 '10 at 21:49
    
@Dmitry, I tried to quickly fix the title before it got moved to Server Fault (where I don't have the rep for such edits) –  Earlz Mar 16 '10 at 21:50
add comment

2 Answers

Your NavURL() method (whether defined locally or imported from some library) contains some logic for resolving the hostname and protocol to be used in URLs. From your description, it sounds like it simply looks up an IP address for the local machine, which is not what you want.

You need to investigate where the host (and protocol) part of the generated URLs are read from. If possible, you might want to modify NavURL() to use a configuration setting containing your root URL. Alternatively, you can determine the hostname and protocol of the current request, by looking at the HTTP request headers, but be careful if you go down this route - the request headers are essentially user input, and should be treated with caution.

share|improve this answer
add comment

I was able to fix the problem by replacing NavURL with ResolveUrl. This isn't the fix I wanted but it works. I still have the exact same site running fine with NavURl on a different server so I'm sure it is a server setting somewhere, but this should do for now.

share|improve this answer
add comment

Your Answer

 
discard

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