Advertisement
Guest User

Untitled

a guest
Apr 21st, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. public class Handle500Erros : HttpRequestProcessor
  2. {
  3. public override void Process(HttpRequestArgs args)
  4. {
  5.  
  6. if (args?.Context?.Response.StatusCode == (int)HttpStatusCode.InternalServerError)
  7. {
  8. var errorPageItem =
  9. Sitecore.Context.Database.GetItem(string.Concat(Sitecore.Context.Site.StartPath, Settings.ErrorPage));
  10. if (errorPageItem!= null && Sitecore.Context.Item.ID!= errorPageItem.ID)
  11. {
  12. Sitecore.Context.Item = errorPageItem;
  13. //var htmlForErrorPageForSpecificlanguage = GetHtmlforErrorItem
  14. // set response html to htmlForErrorPageForSpecificlanguage
  15. }
  16. }
  17. }
  18. }
  19.  
  20. <customErrors mode="RemoteOnly" xdt:Transform="Replace">
  21. <error redirect="/error.html" statusCode="500" />
  22. </customErrors>
  23.  
  24. <rule name="Server Error Rule" stopProcessing="true" enabled="true">
  25. <match url=".*" />
  26. <conditions>
  27. <add input="{URL}" pattern="^/error.html$" />
  28. <add input="{HTTP_HOST}" pattern="^(admin|www).(mysite1|mysite2|mysite3)?.*.(com|co.uk)" />
  29. </conditions>
  30. <action type="Rewrite" url="/errors/{C:2}.html" />
  31. </rule>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement