By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,241 Members | 775 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,241 IT Pros & Developers. It's quick & easy.

HOWTO Make a UserControl deploy an embedded resource.

P: n/a
HOWTO Make a UserControl deploy an embedded resource.

Please help,

I need to embed an EXE into a C# UserControl that is run from script in an
HTML web page as such:

style="display: inline;"

OptiWebDeployer Test...
<script language=jscript>
var objTest;

So far, I've embedded the EXE I need to run as an embedded resource, and can
see from the size of my UserControl that it is getting embedded. But I'm not
sure on how to make the C# code extract it, write it to file, and then
execute the EXE. My Attempt on the Deploy method so far is as such:

public string Deploy()
System.Reflection.Assembly Assembly_This;
Assembly_This = System.Reflection.Assembly.GetExecutingAssembly();
System.IO.Stream Stream_OptiCenter;
Stream_OptiCenter = Assembly_This.GetManifestResourceStream

FileStream FileStream_OptiCenter =
long lLen = Stream_OptiCenter.Length;
byte[] byteOptiCenter = new byte[lLen];
Stream_OptiCenter.Read(byteOptiCenter, 0, (int) lLen);

FileStream_OptiCenter.Write(byteOptiCenter, 0, (int) lLen);
return "EXE was successfully deployed...";

When I try this, I get a run time error as such:

Error: Request for the permission of type
System.Security.Permissions.FileIOPermission,mscor lib, Version=1.0.5000.0,
Culture=neatral,PublicToken=b77a5c561934e089 failed.

So I have questions.
1) Is that C# code correct to deplot the EXE from an embedded resource?
2) Why did I get that security error? I trusted the site from IE, and I
added "http://MySite/*" to the security of my .NET 1.1 config as a URL for
the entire enterprise.
3) How do we actually launch the EXE?
Nov 17 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.