SSI Hierarchy and Implementation

G

Guest

Hi, folks.

It seems like everything I've been reading indicates that I cannot "Include" a *.aspx file located in a higher level directory from that of the calling page's directory...even if I use an absolute path (from docroot):

Page location:
/products/documents/Default.aspx

Include file location:
<!-- #Include File="/includes/Header.aspx" -->

I want to use Header.aspx (which contains additional .NET and HTML code) in all of the pages throughout the site, which could be as deep as:

/1/2/3/4/Default.aspx

....or directly at the document root:

/Default.aspx

We're using C# for all of the pages of a new site that my team is developing. So, I need to know the options and best practices for ASPX SSI up-front. The closest KB article that I found for a workaround was the following one, but even it doesn't mention the ability to call includes located in upper level directories (but still under docroot):

http://support.microsoft.com/default.aspx?scid=KB;EN-US;q306575&ID=KB;EN-US;q306575

I "may" be able to find a way to avoid using server-side code in the SSI, but I'd still like to be able to call that SSI no matter where it resides. Any solid information, tips, or URLs would be greatly appreciated.

TIA,

Bob
 
J

John Saunders

WebGuyBob said:
Hi, folks.

It seems like everything I've been reading indicates that I cannot
"Include" a *.aspx file located in a higher level directory from that of the
calling page's directory...even if I use an absolute path (from docroot):

"Cannot" may not be accurate. "Should not" is accurate.

ASP.NET has User Controls as a mechanism to share content within a site.
They are much better than SSI includes, and can often be converted from an
SSI include directly by the following method:

1) Create a new user control in VS.NET. Use the same name as the SSI, but
with the .ascx extension. It will start off empty
2) Go to the HTML view of the control
3) Copy and paste from the SSI to the user control

You should now be able to just drag the user control onto the design view of
any page that needs it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top