title: Redirect to post with nancyfx
body: <p>With nancyfx is it possible to redirect to another method with post data?</p>
  
  <p>In my example, after a user registers I want to automatically perform a login (I know there are other ways to achive this, I could extract the code from Post["/login"] and call it from both methods but this is a general question and I want to know if this is possible (Maybe I want to redirect to another module which is maintained by another developer and I can't just extract the code).</p>
  
  <p>this is what I want to do (pseudo code)</p>
  
  <pre><code>return RedirectToModule&lt;LoginModule&gt;()
             .WithFormsValue("username", model.UserName)
             .WithFormsValue("password", model.Password);
  </code></pre>
  
  <p>and here is an example with two modules.</p>
  
  <pre><code>public class LoginModule : NancyModule
  {
      public LoginModule()
      {
          Get["/login"] = _ =&gt; {
              return View["login"]; // return login view
          }
          Post["/login"] = _=&gt; {
              // 1. get model
              var model = this.Bind&lt;LoginViewModel&gt;();
              // 2. perform login
              // ...
              // 3. redirect to home
              return Response.AsRedirect("~/");            
          };
      }
  }    
  public class RegisterModule : NancyModule
  {
      public RegisterModule()
      {
          Get["/register"] = _=&gt; {
              return View["register"]; // return register view
          };
          Post["/register"] = _ =&gt; {
  
                // 1. get model
                var model = this.Bind&lt;RegisterModel&gt;();
                // 2. create new User
                // ...
                // 3. redirect To /login with post data (pseudocode)
                return RedirectToModule&lt;LoginModule&gt;()
                   .WithFormsValue("username", model.UserName)
                   .WithFormsValue("password", model.Password);
          };
      }
  }
  </code></pre>