0

I'm currently writing an MVC 5 application and one of my web pages requires that I transform some XML using an XSLT and render the results as HTML on a web page, I've managed to get this working using this great example here: Using XSLT in ASP .NET MVC 3.

This example appears to add a CacheDependency to the Response object, however the constructor for a new CacheDependency requires you pass an absolute file path to the XSLT. This is working fine if I pass the hard disk location of the XSLT to the constructor for eg:

Response.AddCacheDependency(new CacheDependency(@"C:\Mytempalates\TheTemplate.xslt"));

However, I'm wondering if it's possible pass a virtual/relative path as a parameter to this constructor instead as Ideally I don't want to be hitting the disk.

So if my template was hosted at: http://www.mywebsite.com/Templates/TheTemplate.xslt How can I add it as a CacheDependency?

Thanks in advance!

Community
  • 1
  • 1
Jaffacakes82
  • 178
  • 17

1 Answers1

0

Sorry I was wrong: A custom cache dependency class can only monitor local files and not URL files.

The alternative is to create a timer that checks the URL's content using an interval, and if it notices a change, then you manually invalidate the cache by setting Cache["URLContent"] = null.

Let me know if you need help understanding this.

Saturn K
  • 2,705
  • 4
  • 26
  • 38