OwinContext.Request parsing multiple pieces / form-data?

Is there an easy way to parse information from multiple data parts / forms from an OwinContext.Request instance ?

I know how to do this using HttpContext.Current.Request.Form.Get () , but I'm not sure if I really want to do this in the Owin pipeline.

I know I can use .ReadFormAsync () to get an IFormCollection , which seems to work fine for standard views, but with data from multiple parts / forms after this column value, content type, and variable name are all passed into the key. So I can't just do formVars.Get ("VariableName") because it's not a variable name, it's a composite. It doesn't seem like it should be, though ... right?

public AppFunc PreAuthMiddleware(AppFunc next) {
  AppFunc appFunc = async (IDictionary<string, object> environment) => {
    IOwinContext context = new OwinContext(environment);
    IFormCollection formVars = await context.Request.ReadFormAsync();

    ... Now What ...

    await next.Invoke(environment);
  };
  return appFunc;
}

      

I was hoping that accessing form variables and files would be as easy as using HttpContext , but it looks like more work can be done.

If anyone has any idea about this please let me know. Otherwise, I'll probably just end up hacking the key names together if I see the main content type being multipart / form-info.

+3
forms multipartform-data owin


source to share


No one has answered this question yet

Check out similar questions:

1161
What does enctype = 'multipart / form-data' mean?
768
How to disable submit buttons
711
Prevent users from submitting the form by pressing Enter.
497
Tool to send multipart / form-data request
eleven
POST for multipart form for Bamboo API
nine
interceptor okhttp loggin in multipart
five
WebLogic 10gR3 - UnsupportedEncodingException Parsing Content-Type header for multipart / form-data
2
Super Agent: Pluralized PUT-ing Data
0
OwinContext Environment does not contain the added element
0
Loading a multi-part form from android



All Articles
Loading...
X
Show
Funny
Dev
Pics