This project has moved. For the latest updates, please go here.

how to read querystring values and asp.net controls in httphandler page

Jun 21, 2010 at 8:56 AM

Hi Micheal,

i am using the upload control inside a aspx page which have some querystring values which represent the folderid and userid example:- (upload.aspx?folderid=xxxx-xxxxx&userid=xxxxx)

and also some checkbox option that user might select before the upload.

When user click on the upload, the htpuploadhandler gets fired.

How can i read these querystring values and checkbox checked status inside the upload handler page (.ashx file)?

Thanks in advance.

Jun 28, 2010 at 11:33 AM
Edited Jun 30, 2010 at 4:25 AM

Hi Micheal,

any way to  read asp.net controls in httphandler page? i got stuck here. i manage to figure out how to get the querystring value but not sure how to get reference to the asp.net controls.

 

Jul 2, 2010 at 1:07 PM
kriskakani - So how do you read query string values?
Coordinator
Jul 4, 2010 at 3:02 PM

You should set the QueryString parameters you want to use in the HttpHander using CustomParam in the InitParams.

See http://www.michielpost.nl/Silverlight/MultiFileUploader/ for more details about the CustomParam

Jul 7, 2010 at 7:12 AM
Edited Jul 7, 2010 at 7:12 AM

hi voyteks : sorry for late reply,

when you set UploadHandlerName, place a varaibles. example:- the below case it is "qs". 


aspx file code 


<object id="MultiFileUploader" data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="450" height="280">
            <param name="source" value="/SilverLightControls/mpost.SilverlightMultiFileUpload.xap" />
            <param name="onerror" value="onSilverlightError" />
             <param name="initParams" value="MaxFileSizeKB=<%=MaxFileSizeInKB%>,MaxUploads=2,FileFilter=,ChunkSize=4194304,CustomParams=yourparameters,DefaultColor=White,UploadHandlerName=UploadHandler.ashx<%=qs%>" />
            <param name="background" value="white" />

 ..........
..........
.........</object>

 aspx,cs file code

in the code behind fill the variables.

protected string qs = "" ;

qs = "?workbinid=" + WorkbinID.ToString() + "&folderid=" + nodeSelectedIndex; // fill the querystring values here.

 

Coordinator
Jul 7, 2010 at 8:13 AM

That might work.

Or use the "CustomParams=yourparameters" in the initParams. It's designed to hold custom params.

Jul 12, 2010 at 4:35 AM
Edited Jul 12, 2010 at 4:36 AM

when calling the control in a aspx file.

1. how can i set these CustomParams

2.how can i read them in the handler page? any sample code?

Also if i have a checkbox in the main aspx page, how can i get the checked/unchecked status in the handler page?

Feb 14, 2012 at 9:20 PM

I am looking for a similar answer.  I want a user to be able to set the metadata fields for all the files being uploaded similar to what is showcased here:  http://priteshdave.wordpress.com/2010/08/09/multiple-upload-with-metadata/

Thanks so much.

 

-Charles

Coordinator
Feb 15, 2012 at 8:16 AM

You will have to create something custom for that. The best workflow for this scenario is:

1) Let user upload files
2) Finish and go to the next page
3) Let the user input metadata for the uploaded files

You can create a custom page for step 3 and let the user fill in all the metadata you need.