Cipher
Cipher

Reputation: 6082

Porting a C# desktop app to web

I built a desktop WPF C# application for some purpose. The C# application calls functions in another C++ application and the results from the C++ application were exposed back to the C# application. The application is working fine, but I intend to take same functionality to the web (ASP.NET)

Can I use the same kind of thing that I used in my desktop solution? Can the ASP.NET application call a function into a C++ project, and get back the results from the C++ application? DllImport[CallingConvention = CDecl, CharEncoding=Ansi]

EDIT--
My primary concern is that when I issue function call to C++ application, it takes 5 seconds for the C++ function to do its processing. During this time, the C# application can be considered to be have a froze GUI. What would happen in similar case in the ASP.NET website? Would it be a mess because of multi-threading and all?

Upvotes: 1

Views: 283

Answers (3)

mo.
mo.

Reputation: 3534

it is basically the same! wpf uses the same clr as aps.net the difference is, that a web-app is mostly a multiuser environment. so your com/c++ component must work with concurrent users.

Upvotes: 0

Wiktor Zychla
Wiktor Zychla

Reputation: 48230

There are no problems in calling COM or pinvoked methods from within an ASP.NET application. Even if the call lasts 5 seconds to complete, the client's browser just wait for the answer. As a result, the user experience of your application is just sluggish.

Usually such long lasting server calls are wrapped then in AJAX requests so that at least you can show some information to the user like a spinning circle with "please wait" or something similar.

Upvotes: 1

TcKs
TcKs

Reputation: 26632

Yes, ASP.NET application can use DllImport mechanism.

Upvotes: 2

Related Questions