• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2294
  • Last Modified:

Can I use Response.WriteFile with a physical path across web servers? (ASP.NET)

We currently have two IIS webservers -- web and webapp.  All of our static HTML files live on web and all of our old ASPs and newer ASPX files live on webapp.

An outside consultant is redesigning our website look and feel and has given us all new HTML pages, CSS files, etc. which are all going to live on web.  We're in charge of modifying all the ASPs and ASPX files in house to get them to match the new look and feel.

For testing, we had just copied the template files over onto webapp and were  using Response.WriteFile("/ssi/header.shtml") as an example to include headers and footers in our dynamic apps which are on the webapp server...

However, we really don't want to have duplicate ssi folders on both web and webapp to maintain-- we'd like to keep all the header/footer files on just web -- problem being, if we do something like this: Response.WriteFile("http://web/ssi/header.shtml"), we get the error: 'http://web/ssi/header.shtml' is not a valid virtual path.

Is there a cleaner way to include our header and footer files across web servers?
1 Solution
Ted BouskillSenior Software DeveloperCommented:
You can setup website paths using UNC folders.  It's a little tricky to setup.  What I do is create a Share on the server holding the files.  I then designate a domain account that only has read or write access to that folder.

I then setup the virtual folder (or site) using the UNC path on the other host server and use the 'Connect As' feature to access the remote share.

There are other ways by changing the identity of the application pools but that's not as simple.

If you are simply doing reads to include the files it's a simply safe way to do it.

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now