Search engine results linking into a Sandcastle website

Topics: Developer Forum, User Forum
Apr 10, 2008 at 5:06 PM
Hi, new to this site, I've generated a website from SandcastleHFB and integrated the master page "index.aspx" into an <iframe> on my website...

When I search for a class, the search engine correctly links to the appropriate "/html/T_myClass.html" file. When I follow the link however, obviously the Table of Contents is not displayed, which makes the help system essentially unnavigable. What I want to do is get the search engine to open the "index.aspx" page in my <iframe> and pass in a querystring similar to that below:


Anyone know if this is possible? Anyone encountered a similar issue?

Apr 10, 2008 at 7:28 PM
You can do the following:

In Web\Index.aspx in the SHFB installation folder, change the <iframe> tag to include runat="server":

<iframe id="TopicContent" runat="server" name="TopicContent" class="TopicContent"
Then, at the end of the Page_Load method, add the following:

    // If specified, go to a different default topic
    if(Request.QueryString["topic"] != null)
        TopicContent.Attributes["src"] = Request.QueryString["topic"];
To use it, just set the "topic" parameter in the URL. Include any path such as "html/". That way it works for anything in the website including additional content that may be in a different folder.

I've made these changes so that this is the default behavior. They will be in the next release.

Apr 11, 2008 at 10:50 AM
Edited Apr 11, 2008 at 10:56 AM
Eric, thanks very much for your prompt reply, which worked brilliantly.

If anyone's deploying the "index.html" page instead of "index.aspx", then adding the following to the Initialize function in TOC.js works the same:

var query =;
if(query != "")
   var pair = query.split("=");
   topicContent.setAttribute("src", pair[1]);
Could do with some more error checking and admittedly not tested on many browsers!
Apr 11, 2008 at 3:03 PM
Thanks for the info. I'll add that too. I should think that would work for the .aspx as well as the .html page since they both call the Initialize() function.