예제 #1
0
 protected override IEnumerable<XElement> getSpecificData(WebContext context)
 {
     if(!context.httprequest.Path.StartsWith("/static/") && !context.httprequest.Path.StartsWith("/favicon")) context.LogError(new WrongUrlException());
     return new XElement[] {
         new XElement("path", context.httprequest.Path)
     };
 }
예제 #2
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())));
     }
 }
예제 #3
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())));
            }
        }