as long as buffer is on, ClearContent(), Response.End() works fine.
the only problem with using XMLHTTPResquest to upload, is the user
having to turn on full trust for your site. be sure there are no cross
scripting errors on you site, or it can be used for security exploits.
-- bruce (sqlwork.com)
Andy wrote:
> I have an ASP.NET webpage that allows a user to upload a file from the
> client browser. I want to display an animated gif and report on the
> progress of the upload. The <INPUT> tag used for uploading files
> requires the form to be posted. Posts stop javascripts and GIF
> animations from running for the duration of the upload until a
> response to the post is received from the codebehind and the page is
> re-rendered.
>
> To get around this problem, I'm posting the upload through an XMLHTTP
> control from a client-side javascript function instead. The XMLHTTP
> control runs in parallel with the browser, so javascript and GIF
> animations are able to continue to run simultaneously with the upload
> as it is happening.
>
> This works very well, and the asp.net codebehind generates its regular
> response of the source code for its corresponding HTML .aspx page.
> The XMLHTTP control, and not the browser, receives the codebehind's
> response. As the current page the control is on is still visible in
> the browser, and the XMLHTTP control doesn't re-render pages, the
> returned HTML code is of little use.
>
> It would be great if there was some way to shutdown the automatic
> generation of HTML by the codebehind for its responses to the XMLHTTP
> control's requests, and instead use the responses to send back
> meaningful messages.
>
> In the codebehind's Page_Load function, I've tried:
> Response.SuppressContent = True
> Response.Cache.SetNoStore()
> Response.ClearContent()
> Response.Clear()
> Response.End()
>
> But, the HTML is still being generated and returned as evidenced by
> using an alert box in the clientside code on the XMLHTTP control's
> received contents.
>
> All I want is to be able to do a:
> Response.Write("My message")
>
> without the codebehind generating any other content automatically.
>
> Does anyone know how to do this?
>
> thanks in advance,
> Andy
>
|