Exemplo n.º 1
0
 public void Handle(WebContext context)
 {
     try {
         context.WriteTransformResult(this.templateName, this.getData(context));
     } catch(response.SkipXsltTransformException) {
     } catch(RedirectException) {
         throw;
     } catch(WrongUrlException) {
         throw;
     } catch(Exception e) {
         context.LogError(e);
         context.WriteTransformResult("Exception.xslt", new XDocument(new XElement("root", this.getCommonData(context), e.ToXml())));
     }
 }
Exemplo n.º 2
0
        public void Handle(WebContext context)
        {
            try {
                Uri referer = context.httprequest.UrlReferrer;
                if(referer == null || referer.Host != context.httprequest.Url.Host) {
                    throw new System.Web.HttpException(403, "Wrong referer");
                }

                if(this.shouldBeGuest && context.session != null) throw new FLocalException("Should be guest");
                if(this.shouldBeLoggedIn && context.session == null) throw new FLocalException("Should be logged in");
                context.WriteTransformResult(this.templateName, this.getData(context));
            } catch(RedirectException) {
                throw;
            } catch(WrongUrlException) {
                throw;
            } catch(Exception e) {
                context.LogError(e);
                context.WriteTransformResult("Exception.xslt", new XDocument(new XElement("root", this.getCommonData(context), e.ToXml())));
            }
        }