tags:

views:

69

answers:

2

I'm going to be integrating with an existing application which will have an attached file in its initial HTTP post request to our ASP.NET application.

I've built the logic to extract the file from HttpRequest.Files and even tested it using JMeter.

What I want to do is build a standalone ASP.NET page which can direct the user to the first page of our application, with the option to include the File in the request or not. I'd normally just to a Response.Redirect to get to another page, but I can't determine a way of attaching the File that way.

whats the best way of achieving this?

A: 

Eurgh, a tricky one indeed. Clearly you cannot redirect because a file can only be sent via a http POST operation. Redirects result in a GET.

Perhaps have your initial asp.net page perform the first postback with the file on the server-side, then stream the resulting page back to the user taking care to set any cookies that were given to you to ensure the session is passed on to the user (since it originally belonged to the server-side asp.net code posting the file).

This may or may not work depending on how the target application deals with incoming requests. If there's a proxy server or load balancer in the way, things might get hairy, especially if it is using sticky-sessions and/or watching the IP of the incoming request.

Anyway, just my 0.02c.

Good Luck!

-Oisin

x0n
A: 

If possible, bypass the whole "webform" model for your initial page and just do a HTTP POST to your other page.

It's sort of a hassle, especially if your site uses masterpages and almost everything is nested within a tag.

Larsenal
This is basically the approach I took, creating a plain HTML page with a file input and two buttons, not ideal but it works fine.
TygerKrash