Quantcast
Channel: AjaxControlToolkit Work Item Rss Feed
Viewing all articles
Browse latest Browse all 4356

Commented Issue: AjaxFileUpload assumes no query strings already exist in page URL on postback [27149]

$
0
0
When AjaxFileUpload post back it takes your page URL and appends onto the end of it it's own query strings (contextkey and guid). This works fine if your page URL doesn't already contain any query strings but if it does then you end up with a URL that contains two question marks which then corrupts your own final query string value and this in turn stops the upload from working.
Comments: @nESbo: i had the same problem, but it is other, simple solution for this. It is not neccessary to modify source code of control, just use AjaxFileUpload object's property IsInFileUpluadPostBack in Page_Load event of your page. So, if you check QueryString for any parameter existence in page Load event on initial load (not postback) and then do response redirect, then you must also check IsInFileUpluadPostBack property to make sure that load event is not caused by postback from AjaxFileUpload. instead of: ``` protected void Page_Load(object sender, EventArgs e) { if ( ! IsPostBack ) { if (Request.QueryString["key"] == null) Response.Redirect("any.aspx"); } } ``` write this: ``` protected void Page_Load(object sender, EventArgs e) { if ( ! IsPostBack && ! AjaxFileUpload.IsInFileUploadPostBack ) { if (Request.QueryString["key"] == null) Response.Redirect("any.aspx"); } } ```

Viewing all articles
Browse latest Browse all 4356

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>