I’m trying to preload the output cache in mvc4 application using WebActivator. I figured I could simply make an async call to a few routes and that would do the trick. Unfortunately, I can’t find the Root Url to my app anywhere… There is no current httpRequest.
Here is what I’d like to do.
[assembly: WebActivator.PostApplicationStartMethod(typeof(MaidBrigade.Web.App_Start.CacheLoader), "Load")]
namespace MaidBrigade.Web.App_Start
{
public class CacheLoader
{
public static void Load()
{
var client = new HttpClient();
var root = ""; // Where can a fetch this from?
client.GetAsync(root + "/vision/marketing/NationalReportData");
}
}
}
Try using:
or:
Also try:
And if Request is not available, try: