C# on the Web

  • Thread starter Thread starter Chris
  • Start date Start date
C

Chris

I have developed a client-side C# application (based on
System.Form objects, the Application object, etc).

Is there any easy way to run a client-side application in
a Web Browser? Can ActiveX do this easily? Are there
newer technologies in .NET to do this?

Thanks!
 
You can deploy a WinForms EXE to another PC by giving him a URL for
the .EXE. This is called a Smart Client Application.

- A SmartClient app is basically a Windows Forms app that is deployed
over the web (zero-touch deployment). These applications have full
Windows GUI functionality.

- The user must have the .NET Framework v1.1 on their computer

- The app is downloaded into a "security sandbox" on the user's
computer. The app can NOT read or write to local files within the
normal filesystem, and they can't read or write to/from the registry.

- The app can contact the same internet site where it was downloaded
from in 2 ways: it can call Web Services at that site, and it can open
sockets to that site.

- The app can store data locally in a protected area on the hard disk
(called "Isolated Storage")

- The app can function in a fully "disconnected" manner. Once
downloaded (by clicking on the URL), the program stays in the
"Temporary Internet Files" area of the disk. The user can start the
program when the Internet is down by using "File..Work Offline" in IE.
Then they can give the URL, and it will be loaded from their local
disk. They can read/write to their local protected diskspace. Later
when the Internet comes back online, they can synchronize with a Web
Service or socket.

- if you want the program to have more permissions so it can get out
of the sandbox in a controlled manner, you can create a security
policy for the client's computer. This can be stored in an ".msi"
setup file, that the user can execute over the web by pointing to a
URL. This is called "one touch deployment", because the user has to
execute an .msi file before he can run the program.
 
That's what I wanted to know.

I tried running my application as you suggested and I ran
into a hitch: I'm using DLLImport in one of my modules.
When the CLR tries to load my app it issues a "File Not
Found" exception on my class that does all the
DLLImports. Is there something special that I have to do
to get the Platform Ivoke calls to work.

Here's a snippet of the class that it is complaining
about:

public class DataAccessBridge
{
[DllImport("OWBridge.dll",CharSet=CharSet.Ansi)]
public static extern int InitRecordSet();

...

On a client machine the DllImport works becasue the
OWBridge.dll is in the same directory as my C#
executable. I imagine the rules are different when run
in Smart Client mode...

Thanks!
 
Is there something special that I have to do
to get the Platform Ivoke calls to work.

If your app is running from a web URL (zero-touch deployment), then
you do not have permission to use P-Invoke.

You would have to set up a security policy on the user's computer to
give your application permission to do this. This is not an easy
subject. You might want to do some web research on "Code Access
Security".

Eric
 
Back
Top