Esempio n. 1
0
        protected internal override bool BeforeActionInvocation(Controller controller, WorkContext work, string action, MethodInfo method, object[] args, ref object result)
        {
            if (work.IsGET) return false;

              work.NeedsSession(OnlyExistingSession);

              var session = work.Session;
              var supplied = work.WholeRequestAsJSONDataMap[TokenName].AsString();

              if (session==null ||
              !session.CSRFToken.EqualsOrdSenseCase(supplied))
            throw new HTTPStatusException(NFX.Web.WebConsts.STATUS_400, NFX.Web.WebConsts.STATUS_400_DESCRIPTION, "CSRF failed");

              return false;
        }
Esempio n. 2
0
 /// <summary>
 /// Override to add logic/filtering right before the invocation of action method.
 /// Return TRUE to indicate that request has already been handled and no need to call method body and AfterActionInvocation in which case
 ///  return result via 'out result' paremeter
 /// </summary>
 protected internal abstract bool BeforeActionInvocation(Controller controller, WorkContext work, string action, MethodInfo method, object[] args, ref object result);
Esempio n. 3
0
 /// <summary>
 /// Override to add logic/filtering finally after the invocation of action method. Must return TRUE to stop processing chain
 /// </summary>
 protected internal abstract void ActionInvocationFinally(Controller controller, WorkContext work, string action, MethodInfo method, object[] args, ref object result);
Esempio n. 4
0
 public void Execute(Controller controller, WorkContext work)
 {
     work.Response.Redirect(URL);
 }
Esempio n. 5
0
        public void Execute(Controller controller, WorkContext work)
        {
            if (AttachmentFileName.IsNotNullOrWhiteSpace())
              work.Response.Headers.Add(WebConsts.HTTP_HDR_CONTENT_DISPOSITION, "attachment; filename={0}".Args(AttachmentFileName));

              var fid = Format.Guid;
              work.Response.ContentType = ImageCodecInfo.GetImageEncoders()
                                                .FirstOrDefault(enc => fid==enc.FormatID)
                                                .MimeType;
              Image.Save(work.Response.GetDirectOutputStreamForWriting(), Format);
        }
Esempio n. 6
0
 public void Execute(Controller controller, WorkContext work)
 {
     work.Response.WriteJSON( Data, Options);
 }
Esempio n. 7
0
        public void Execute(Controller controller, WorkContext work)
        {
            var txt = WebConsts.STATUS_404_DESCRIPTION;
              if (Description.IsNotNullOrWhiteSpace())
            txt += (": " + Description);
              work.Response.StatusCode = WebConsts.STATUS_404;
              work.Response.StatusDescription = txt;

              if (work.RequestedJSON)
               work.Response.WriteJSON( new {OK = false, http = WebConsts.STATUS_404, descr = txt});
              else
               work.Response.Write(txt);
        }
Esempio n. 8
0
 public void Execute(Controller controller, WorkContext work)
 {
     work.Response.WriteFile(LocalFileName, BufferSize, IsAttachment);
 }
Esempio n. 9
0
        public void Execute(Controller controller, WorkContext work)
        {
            var gen = (work.Portal!=null) ? work.Portal.RecordModelGenerator
                                    : Client.RecordModelGenerator.DefaultInstance;

              work.Response.WriteJSON( gen.RowToRecordInitJSON(Row, ValidationError, RecID, Target, IsoLang, ValueListLookupFunc) );
        }
Esempio n. 10
0
 protected internal override bool BeforeActionInvocation(Controller controller, WorkContext work, string action, MethodInfo method, object[] args, ref object result)
 {
     return false;
 }
Esempio n. 11
0
 protected internal override bool AfterActionInvocation(Controller controller, WorkContext work, string action, MethodInfo method, object[] args, ref object result)
 {
     work.Response.SetNoCacheHeaders(Force);
       return false;
 }
Esempio n. 12
0
 public void Execute(Controller controller, WorkContext work)
 {
   work.Response.WriteJSON( Client.RecordModelGenerator.RowToRecordInitJSON(Row, ValidationError, RecID, Target));
 }
Esempio n. 13
0
 public void Execute(Controller controller, WorkContext work)
 {
     work.Response.Redirect(URL);
 }
Esempio n. 14
0
 public void Execute(Controller controller, WorkContext work)
 {
     work.Response.WriteFile(LocalFileName, BufferSize, IsAttachment);
 }
Esempio n. 15
0
 public void Execute(Controller controller, WorkContext work)
 {
     work.Response.WriteJSON(Data, Options);
 }