Пример #1
0
 protected override void OnInit(EventArgs args)
 {
     Response.Status = "500 Internal Server Error";
     try
     {
         N2.ContentItem page = N2.Templates.Find.StartPage.ErrorPage;
         if (page != null)
         {
             var wc = N2.Context.Current.Resolve <N2.Web.IWebContext>();
             wc.CurrentPage = page;
             Server.Execute(Url.Parse(page.FindPath(PathData.DefaultAction).RewrittenUrl).AppendQuery("postback", page.Url));
             Response.End();
             return;
         }
     }
     catch (Exception ex)
     {
         Trace.Write(ex.ToString());
     }
     Response.Write("<html><body><h1>500 Internal Server Error</h1></body></html>");
     Response.End();
 }
Пример #2
0
 protected override void OnInit(EventArgs args)
 {
     try
     {
         N2.ContentItem page = N2.Templates.Find.StartPage.NotFoundPage;
         if (page != null)
         {
             var wc = N2.Context.Current.Resolve <N2.Web.IWebContext>();
             wc.CurrentPage = page;
             Server.Execute(Url.Parse(page.FindPath(PathData.DefaultAction).RewrittenUrl).AppendQuery("postback", page.Url));
             Response.Status = "404 Not Found";
             Response.End();
             return;
         }
     }
     catch
     {
     }
     Response.Status = "404 Not Found";
     Response.Write("<html><body><h1>404 Not Found</h1></body></html>");
     Response.End();
 }