Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Embedding WinForms in WebForms ?

Reply
Thread Tools

Embedding WinForms in WebForms ?

 
 
Andrew
Guest
Posts: n/a
 
      06-03-2004
Hi all,

I am coming from the ASP Classic and VB6 world. Getting into .net, but
still relatively new. I am beginning to hear rumblings from on high that we
will be transitioning our website from ASP to ASP.net. However, on our
Intranet side (which will undoubtedly be converted also) we have several
ActiveX Controls. These controls were all created here -- no third party
controls that is. The controls serv as the means to upload multiple files
at one time, communicate direct to the DB wihtout causing page refresh,
allow various data manipulation, etc. The controls were a best case
alternative in that they were self contained, debug-able, and could be
"many-in-one" devices. Since these are only used on our Intranet, the
security was not an issue.

Now that I see we need to get ready for moving to .net, I have been trying
to learn the .net way of making similar controls. I have found a couple
websites that discuss embedding Windows Forms inside Web Forms:

http://samples.gotdotnet.com/quickst...eSourcing.aspx
http://www.devhood.com/tutorials/tut...=187&printer=t

Yet while these two give some basic information about how the controls need
to be designed, what goes into them, and so forth....they are very simple --
making text bold, changing text, etc. I have been able to get these to work
just fine. It's just....when I try to go a little more extreme, I run into
problems...

I tried to create a simple control that would open a text file -- path
supplied by typing it in a textbox and clicking the "go" button -- and
display the text contents in a multiline textbox. Yet when I try to run it,
I am getting an error:

System.Security.SecurityException: Request for the permission of type
System.Security.Permissions.FileIOPermission, mscorlib, Version=1.0.5000.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089 failed.
at System.Security.CodeAccessSecurityEngine.CheckHelp er(PermissionSet
grantedSet, PermissionSet deniedSet, CodeAccessPermission demand,
PermissionToken permToken)
at System.Security.CodeAccessSecurityEngine.Check(Per missionToken
permToken, CodeAccessPermission demand, StackCrawlMark& stackMark, Int32
checkFrames, Int32 unrestrictedOverride)
at System.Security.CodeAccessSecurityEngine.Check(Cod eAccessPermission
cap, StackCrawlMark& stackMark)
at System.Security.CodeAccessPermission.Demand()
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess
access, FileShare share, Int32 bufferSize, Boolean useAsync, String msgPath,
Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess
access, FileShare share, Int32 bufferSize)
at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean
detectEncodingFromByteOrderMarks, Int32 bufferSize)
at System.IO.StreamReader..ctor(String path)
at ReadFile.ReadFile.cmdReadFile_Click(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventAr gs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons
button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage (Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(M essage& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam)

I have tried setting security to low for the file, folder, IIS,
everything....I have used the MS .Net Security Policy Administration Wizard
to lower security...I just don't know what else I need to do to get this to
run correctly.

Could someone help me understand what I need to do in order to get WinForms
embedded in WebForms (regardless of the purpose of the code used in the
WinForm) to function without errors?

Your help/input greatly appreciated.

-- Andrew


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using the same class library in WinForms and WebForms projects David Jackson ASP .Net 10 05-07-2009 02:56 PM
Productivity: WebForms vs. WinForms Martin Rosén-Lidholm ASP .Net 20 07-08-2004 01:42 PM
Re: Productivity: WebForms vs. WinForms Phil Winstanley [Microsoft MVP ASP.NET] ASP .Net 0 06-21-2004 11:41 AM
Embedding Webforms PsiMan ASP .Net 1 07-09-2003 04:28 PM
Embedding webforms controls in asp.net page? John Sparrow ASP .Net 2 06-26-2003 09:58 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57