DefconDotNet

Untitled

Dec 11th, 2013
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.70 KB | None | 0 0
  1.  
  2.     public static class PrefetchHelpers
  3.     {
  4.         public static MvcHtmlString Prefetcher(this HtmlHelper html)
  5.         {
  6.             var session = html.ViewContext.RequestContext.HttpContext.Session;
  7.             if (session == null)
  8.                 return MvcHtmlString.Create("<iframe style=\"display: none;\" src=\"/Cms/Prefetch\"></iframe>");
  9.            
  10.             if(session["NOT_FIRST_PAGE"] == null || !(bool) session["NOT_FIRST_PAGE"])
  11.             {
  12.                 session["NOT_FIRST_PAGE"] = true;
  13.                 return MvcHtmlString.Create("<iframe style=\"display: none;\" src=\"/Cms/Prefetch\"></iframe>");
  14.             }
  15.  
  16.             return MvcHtmlString.Empty;
  17.         }
  18.     }
Advertisement
Add Comment
Please, Sign In to add comment