FileUploadParameter String reference not set to an instance of a String.  
Author Message
jakeb16





PostPosted: .NET Base Class Library, FileUploadParameter String reference not set to an instance of a String. Top

So I am trying to use the FileUploadParameter class to add a paramter to the FormPostParamaters Collection.

requestBody.FormPostParameters.Add(new FileUploadParameter( "_ctl0:_MainContent:_ContentControl:_ctl0:_ctl8:_ctl4:_ctl2:_ctl3:_fileUploadContainer","C:\\Documents and Settings\\jsblumbe\\My Documents\\Jacobs Templete.doc"));

The problem is that when I use this I get the following in the responce:

RequestFailed:String reference not set to an instance of a String.

Paramater name: s

If I take out the file name and use this

new FileUploadParameter( "_ctl0:_MainContent:_ContentControl:_ctl0:_ctl8:_ctl4:_ctl2:_ctl3:_fileUploadContainer",""));

I get

RequestFailed: Empty path name is not legal

which is fine, but it just proves that there is something wrong with the fileUploadParamater class....

Can any one help me debug this

HEre is the HTML for the control

<input name="_ctl0:_MainContent:_ContentControl:_ctl0:_ctl8:_ctl4:_ctl2:_ctl3:_fileUploadContainer"
id="_ctl0__MainContent__ContentControl__ctl0__ctl8__ctl4__ctl2__ctl3__fileUploadContainer"
type="file" size="40" />

The actuall control is based off the HtmlInputFile class in System.Web.UI.HtmlControls



.NET Development12  
 
 
jakeb16





PostPosted: .NET Base Class Library, FileUploadParameter String reference not set to an instance of a String. Top

So I found the problem...

I accidentally was adding an extra FormPostParameter

Inside this extra parameter inside the name member was set to a string which matched the first part of a control on the page but was not complete.

This extra parameter caused all sorts of wired behavior and error messages and once removed everything seemed to be back to normal.