0

I have found these threads: thread1, thread2, and thread3 but it's not answering my question. I am creating a master page but all the navigation menus are coming from an absolute path. In the past I have downloaded the .html file and used SSI but if there is a change in the navigation menu, I do not have the latest menu. So, what are my alternatives? I need the capabilities similar to SSI but using absolute path pointing to a http://mydomain.com/myMenu.html file.

Community
  • 1
  • 1
2myCharlie
  • 1,587
  • 2
  • 21
  • 35
  • 1
    Why would you want SSIs for a master page? Master pages centralize your markup, as SSIs do. If there is some reason, perhaps you have multiple master pages you want to feed the same content to, user controls could be a good fit. – Mister Epic Dec 18 '13 at 15:43
  • I do not have control over the navigation menu; thus, I have been using SSI on my master pages. However, it's causing a lot of errors when testing on local machine and a few other issues. That is why I like to know if there is a better option out there. I have not looked much deeper into user controls, but basically all I need is a way to point to a specific .html file using URL. I'm not sure if user control can point like that. – 2myCharlie Dec 18 '13 at 16:08
  • 1
    What do you mean "you don't have control over the navigation menu"? The point of SSI is to centralize your stuff, using it on a Master Page is redundant and adds unneeded complexity. Of course, a link can point to a specific address, that's the point of a link. – mason Dec 18 '13 at 16:16
  • I mean the navigation menu is done by someone else. I have to point to that html file. Currently this is what I have.
    I wanted something like this:
    But that does not work.
    – 2myCharlie Dec 18 '13 at 16:36
  • I'm having problem formatting my code in here. – 2myCharlie Dec 18 '13 at 16:40

1 Answers1

1

The reason this does not work (based on your comments) is that you're trying to do a server side include from a different website. That just won't fly because it's a security risk. In fact, that's a technique that phishing sites would love to be able to do.

What you could do is a WebRequest to download the HTML from the other site and then embed it as a literal on your page. Do this during the Page_Load method. This gets around the need for Server Side Includes.

When you say the navigation menu is "done by someone else", are they part of your team? If so, it'd be a good idea to host the navigation menu as a custom user control (.ascx) on your site. Then you can embed that user control in your master page.

mason
  • 31,774
  • 10
  • 77
  • 121
  • Many thanks for the explanation and response. The navigation is done from the main department. So here's what file structure looks like: Main site: http://www.mainSite.com/ My site: http://www.mainSite.com/mySite The nav.html is located in http://www.mainSite.com/ssi/nav.html I have also used ssi with relative path by ../ssi/nav.html; however, my biggest problem is that when I test my site on my local machine or personal web server, it does not work because there is no nav.html at location ../ssi/ that is why I thought of using an absolutely path so that it will work anywhere. – 2myCharlie Dec 18 '13 at 17:37
  • Will somebody show me or link me to a instruction how to format in here? I'm having issue with putting link or codes in here. My above file structure link got removed when displaying. – 2myCharlie Dec 18 '13 at 17:38