Slightly tweak the redirect code...

--HG--
branch : dev
This commit is contained in:
Renaud Paquay
2010-07-01 16:57:07 -07:00
parent 81e3001014
commit ed3bece16e
3 changed files with 29 additions and 5 deletions

View File

@@ -99,6 +99,7 @@
<ItemGroup>
<Content Include="Default.aspx" />
<Content Include="Global.asax" />
<Content Include="Refresh.html" />
<Content Include="Themes\TheAdmin\Styles\ie.css" />
<Content Include="Web.config">
<SubType>Designer</SubType>

View File

@@ -0,0 +1,15 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Configuration Changing...</title>
</head>
<body>
<p>
Orchard is temporarily unavailable as a change in configuration requires a restart.
A simple page refresh usually solves this issue.</p>
<script type="text/javascript">
window.location.reload();
</script>
</body>
</html>

View File

@@ -152,13 +152,21 @@ namespace Orchard.Environment {
protected virtual void BeginRequest() {
MonitorExtensions();
BuildCurrent();
// If setting up extensions/modules requires an AppDomain restart, it's very unlikely the
// current request can be processed correctly. So, we redirect to the same URL, so that the
// new request will come to the newly started AppDomain.
if (_setupExtensionsContext.RestartAppDomain) {
if (HttpContext.Current != null)
if (HttpContext.Current != null) {
// Don't redirect posts...
if (HttpContext.Current.Request.RequestType == "GET")
if (HttpContext.Current.Request.RequestType == "GET") {
HttpContext.Current.Response.Redirect(HttpContext.Current.Request.ToUrlString(), true /*endResponse*/);
else
throw new HttpException(T("Orchard is temporarily unavailable as a change in configuration requires a restart. A simple page refresh usually solve this issue.").Text);
}
else {
HttpContext.Current.Response.WriteFile("~/Refresh.html");
HttpContext.Current.Response.End();
}
}
}
}