Refresh BlogEngine.net Posts - Clear Cache

by Admin5. March 2010 01:12

from:Arnold Matusz's Blog
Lately I’ve come across an interesting situation involving BlogEngine.Net. I normally use Windows Live Writer to write my blog posts, and as I really love to post some programming related articles I use Syntax Highlighter. Sadly I don’t have Windows Live Writer set up (with all the plugins) on each workstation I work on, so whenever I need to change something in a post (typos, updates, etc.) and WLW is not at hand I get down and dirty and edit the XML files which the posts are saved in.

I hear you asking: Why you stupid idiot are you doing that when you can edit your posts in a nice WYGIWYS editor? Well, the only reason is that when I post code samples those need to be in pre tags where each and every space i very important. And after I edit/save a post in BE’s (online) the formatting is lost.

So, back to the situation, you download your XML file, edit what you need … and after you upload it back to its place you notice that the post remains the same when viewing it in the browser. This is due to the fact that BlogEngine is heavily caching blog posts for you to have an almost instance response when you access the website. This is an awesome technique which definitely does not need to be changed, but we can find a little workaround so we can clear the cache whenever we want to.

After a short search I came across the Reload() method which many people suggested will solve the issue.

try
{
BlogEngine.Core.Post.Reload();
}
catch { }

But sadly after further investigation I realized that this only refreshes the  list of posts. In fact to solve the issue you only have to use some native  ASP.NET code from the HttpRuntime class.

MSDN Source: – HttpRuntime.Close() –> Removes all items from the cache.

I created a page called Reset.aspx in the /Admin/Pages folder which contains a Button and a Label (for displaying a status message – or error message :) ).

The corresponding event handler:

protected void btnReset_Click(object sender, EventArgs e)
{
try
{
BlogEngine.Core.Post.Reload();
//HttpRuntime.Close();
lblResult.Text = "Reload successful!";
}
catch
{
lblResult.Text = "Not successful!";
}
}

For this page to be visible in your admin panel’s menu section you need to edit your web.sitemap file located in the root of the BlogEngine instance by adding the following line of markup.

Now, whenever for NO GOOD reason you need to edit your blog post files offline, you can clear the cache at the push of a button.

Tags: ,

.Net

Comments (2) -

flsa overtime
flsa overtimeUnited States
3/26/2012 12:38:20 PM #

I truly appreciate your time and effor

Reply

chek
chekPeople's Republic of China
5/14/2012 4:29:02 PM #

[url=http://www.christiansale.net/]christian sale[/b][/url] Zinc is about the various find vitamins requested through figure, still the advantage that it will be requested for remarkably a small amount actually permitted to hidden the country's worth. It will be requested through figure for those formulation of greater than 210 imperative digestive support enzymes, about the most really important the hands down simply being superoxide dismutase, [url=http://www.topchristianlouboutin.org/]red high heels[/b][/url] a necessary anti-oxidant. The store's incredible importance of superoxide dismutase is based on the country's place for scrubbing in the superoxide free of cost radicals which you'll find issued regarding all the the metabolic process about the necessary oxygen around panels, almost by means of just about every single inhale everyone receive. Superoxide free of cost radicals kick in by means of other sorts of by-products of one's formulation to create hydroxyl, some of the most endangering free of cost sweeping at all, [url=http://www.topchristianlouboutin.org/]heels for women[/b][/url] [/b]and also approach all the mitochondria for the panels his or her self. Ever since it's the mitochondria in which really provide the vitality for the anatomy's imperative replies, mitochondrial affect attributable to free of cost radicals may well sole entail all the formulation about a lot less and additionally a lot less energy levels and therefore the gentle damage and additionally deterioration for the comprehensive affected individual. [url=http://www.topchristianlouboutin.org/]christianlouboutin[/b][/url] Combined with simply being imperative for those anatomy's generation about anti-oxidants, zinc equally helps to all the immune mechanism to manage the job that substandard or possibly completely maxed panels really are wiped out shut off through figure prior to when they also have opportunity to improve his or her self along with perhaps really turned into dangerous. All of these works exclusively may allow it to amongst the primary micronutrients which you'll find imperative to anatomy's long-term health and wellness. Still you'll find that there's a whole lot more to make sure you zinc when compared to this approach, as it will be at this time considered to be needed for all the [url=http://www.topchristianlouboutin.org/]louboutins[/b][/url] [/b]formulation for the along with white hold panels which you'll find amongst the anatomy's first of all marks about support to protect against condition, and additionally for those ideal carrying out for the thymus gland which is certainly intensively active in the laws for the immune mechanism. For that reason zinc is essential as well as for staving shut off long-term deterioration, , in rebuffing serious bacterial. This kind of certainly announced appeal as being a definite immune mechanism enhancer comes with presented with zinc awesome status in the form of icy and additionally flu treat, eventhough the potency of numerous lozenges advertised for this reason at the time affliction is made continues as designed to topic. However, the key incredible importance of a normal functioning immune mechanism for advoiding condition in the beginning isn't really for doubting the fact that. And right make fish an the correct method of getting zinc is obviously important. As well as the average desire for zinc will be 15 mg just a day, [url=http://www.louboutinonsale.net/]cheap louboutin[/b][/url] it's always astoundingly straightforward to crash here this approach. Genuinely a lot of bids claim that average vitamin intakes could very well be just 9 mg for females and additionally 13 mg just for men of all ages, in addition to this is badly taken for that reason a lot of dieticians urge targeting any consume about round 27 mg to assure a sufficient resource. The software should also come to be commemorated that particular categories of people who had miserable immune : platforms, that include HIV persons, diabetes patients and additionally alcoholics has a better desire for zinc. Still for sure huge these sort of crew is normally made up of all the across 65s. [/b][url=http://www.louboutinonsale.net/]women high heels[/b][/url]  And additionally it ought to be awakened to the fact which usually the result of a fabulous zinc lack could very well be a whole lot more dangerous just for all of these elder all those, seeing that most of the immune : platforms be apt nevertheless that should be a lot less beneficial when compared to many about nourishing adults. [url=http://www.louboutinonsale.net/]louboutins shoes[/b][/url] I[/b]n order that the result is very much simple and easy: making certain the diet plan is normally the correct for zinc is critical to economy for the immune mechanism, thereby to make sure you long-term well-being and health. Still like frequently by means of the body, the message is not actually really quite for that reason straight forward. Your physique works naturally, and additionally surplus each of these source of nourishment will probably end in a fabulous lack for an alternative. Ingesting a rediculous amount of club, as an illustration, will probably inside of it end in a fabulous lack for zinc. Still if you are surplus zinc (defined through U . S . Cuisine and additionally Eating Enter like beyond 60 mg a fabulous day), [url=http://www.louboutinonsale.net/]louboutin on sale[/b][/url] all the similar lack is normally about water piping. Lack for water piping is normally scarcely excessive sufficiently producing investigation and discomforts, still these businesses not likely hidden the key works from this find nutrient. With regards to zinc, the correct offers about water piping really are imperative for those formulation about anti-oxidant digestive support enzymes and additionally energy levels throughout the anatomy's panels. Sub-clinical inadequacies are also suggested as a factor for events about nominal anaemia and additionally unhappiness for the immune mechanism. [url=http://www.christiansale.net/]boutique louboutin[/b][/url] [/b]The way to circumvent all of these disadvantages is normally, surely, for you to eating better full simultaneously zinc and additionally water piping. White the meat selections, really burgers, and additionally shellfish really are identified as wonderful pet animal assets, even when nut products and additionally coffee beans provide a advantageous cause just for vegetarians. Entirely grains are really a advantageous increased sow way to water piping. [url=http://www.christiansale.net/]red high heels[/b][/url] Sow causes of zinc, still, really are a lot less certainly taken through figure when compared to many produced pet animal assets, for that reason they can be a source of nourishment which might want precise curiosity for following vegetarian weight loss plan. Still presented with all the lower income about cutting-edge North west quality diets for simultaneously nutrients, supplementing will probably nevertheless come to be appropriate to guarantee the health and wellness for the immune mechanism, really, like layed out in this article, for those across 65s. Many different sorts targeted zinc aid can easily be bought, it also is normally smarter so that whatever supplementing about zinc is normally absorbed in an adequately [url=http://www.christiansale.net/]high pumps[/b][/url] good multi-mineral method equally featuring the correct magnitude of water piping.

Reply

Add comment

  Country flag

biuquote
Loading

我的饭否

Widget RandomPosts not found.

The file '/blog/widgets/RandomPosts/widget.ascx' does not exist.X

RecentComments

Comment RSS

Google PageRank