06 December 2007

Hosting a Window Form Control in a SharePoint WebPart

Some months ago I posted about Hosting a Windows Form Control in a web page. I explained there how we can run a WinForm control from Internet Explorer by hosting it in a web page using the <object> tag. Now suppose you want to use the same solution in a custom web part that is included in a Sharepoint site. I will describe here where the control library should be placed and how it can be referenced from the web part.

When we develop a custom web part, we place its resources under the _wpresources web site, into a folder named <WebPartAssemblyName>/<WebPartAssemblyVersion>__<PublicKeyToken>. You can create there a subfolder (named "bin" por example) to place the win control assembly. This folder must have execute permissions set to Script Only (not Script and Executables as is the default under a SharePoint site). The picture bellow shows the resulting structure when placing the win form control assembly in a web part called MyCustomWebPart that is part of the MyCustomWebParts assembly: ...

Read full article


tom said...

Could you explain whether a hosted (legacy windows) application is run as a stand alone windows app, or is somehow executed within a child MDI window? Also, could elaborate a little on whether APIs are included that can provide the status of whether an arbitrary application is already executing, or needs to be started, can tell whether its in the foreground, or not, can bring it to the foreground if necessary, etc.?
Thanks in advance.

Sole said...

Hi Tom, you don't need a windows app (exe) to run in order to use the windows form control in a web app (if this is your question about).