Error - Key not found

Dec 2, 2009 at 12:48 AM

We're using VS2008 SP1 and have recently download the project, built the solution and attempted to run the program without success,
After setting FileUploadTestPage.html = Set as Start Page  and executing the solution.   We have an error appear

<font size="2" color="#2b91af"><font size="2" color="#2b91af">

</font></font><font size="2" color="#2b91af">


URI uri = new Uri(HtmlPage.Document.DocumentUri, HttpUtility.UrlDecode(e.InitParams["UploadPage"]));  "The given key was not present in the dictionary."

 The stacktrace is as below

at System.ThrowHelper.ThrowKeyNotFoundException()
   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   at FileUpload.App.Application_Startup(Object sender, StartupEventArgs e)
   at System.Windows.CoreInvokeHandler.InvokeEventHandler(Int32 typeIndex, Delegate handlerDelegate, Object sender, Object args)
   at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, String eventName)

Any suggestions are appreciated.

Aug 15, 2010 at 6:00 PM
Edited Aug 15, 2010 at 6:04 PM

you need to add a param for initParams " <param name="initParams" value="UploadPage=FileUpload.ashx,Filter=Images (*.jpg)|*.jpg" />" in the html code. See example below:


 <div id="silverlightControlHost">
		<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">
			<param name="source" value="ClientBin/FileUpload.xap"/>
			<param name="onerror" value="onSilverlightError" />
			<param name="background" value="white" />
			<param name="minRuntimeVersion" value="2.0.31005.0" />
			<param name="autoUpgrade" value="true" />
            <param name="initParams" value="UploadPage=FileUpload.ashx,Filter=Images (*.jpg)|*.jpg" />
			<a href="" style="text-decoration: none;">
     			<img src="" alt="Get Microsoft Silverlight" style="border-style: none"/>
		<iframe style='visibility:hidden;height:0;width:0;border:0px'></iframe>