How to call a windows form app from ASP.net - asp.net

I am trying to use activeX to start a windows form application written in C# from my ASP.net website. When I click a button I would like a new page to open up and activeX on that page would call my windows application.
I am using Visual Studio 2010. I have followed this tutorial: http://dotnetslackers.com/articles/csharp/WritingAnActiveXControlInCSharp.aspx
However, that tutorial is only for 1 C# file which you compile via console.
My questions are the following:
1.How would I compile the entire windows form project to use the /t:library and regasm?
2.I have followed this question answer to modify my windows form application: How do I create an ActiveX control (COM) in C#?. However, like in both examples, they do not have a Main method. When I tried to modify the code of my windows form app, I get the error saying the program does not have a Main method for entry if I take it out and replace it with a Launch() method. I am sure I am missing something?
3.Would I just write the java script on the new .aspx page to access the application?
P.S. I am trying to open this open source windows form application: http://www.codeproject.com/Articles/239849/Multiple-face-detection-and-recognition-in-real-ti
Thank you kindly

You can not do that. It would be huge security risk to allow websites to execute arbitrary code on local machine, outside of some sandboxed environment (like JavaScript for example).
AFAIK closest thing to what you want is ClickOnce, that is a installer and use it to install your WinForms app on client machine. It's easy to make installation for project, just right click in VS and publish.

There is a solution that you may be able to use called ClickOnce.
http://msdn.microsoft.com/en-us/library/t71a733d%28v=vs.100%29.aspx
I've created enterprise applications that I deploy to an internet accessible location and link my users to the "publish" website that allows them to click, install, and run the application.
Keep in mind that this will install the application in addition to running it, so if part of your requirements is to not install it, then ClickOnce won't work for your scenario.

I would suggest you can create ActiveX control instead of a Windows Form. You can create it using legacy VB (VB 6.0). You can refer something like
http://www.visualbasicbooks.com/activeXtutorial.html
http://blogs.msdn.com/b/ajma/archive/2004/08/12/213868.aspx

Related

Debugging a VB6 ActiveX DLL called via VBScript in a Classic ASP Application

Whelp, I avoided it as long as possible, but the time has finally come to make some changes to some ancient VB6 code. I'm a recent college grad so I was hoping to stay away from this code that is almost as old as I am.
The DLL is compiled in a local installation of VB6 and deployed via Component Services. That component is then called by VBScript in a Classic ASP application running on a windows 2003 Server.
I've tried just about everything to debug this code using the VB6 debugger, but I can't get it to work. I've compiled the DLL to the same location that Component Services has it deployed to (a random folder on a non-system drive), and set binary compatibility to that same DLL. Each class file has instancing set to MultiUse and MTSTransactionMode set to '1 - NoTransactions.' The component works fine until I attach the debugger, then I get 'ActiveX component can't create object' when trying to instantiate the object. If I detach the debugger, it works again.
I noticed that in Component Services when I attach the debugger, the DLL location changes to C:\Program Files\Microsoft Visual Studio\VB98\VB6DEBUG.DLL, which I assume is just VB6 intercepting calls to the component. When I detach the debugger, it changes back. I should also note that the component is configured to use a specific user identity separate from my logged-in user account, however everyone has been granted access to the component via a user role. The component activation type is also 'Server Application,' however setting it to 'Library Activate' doesn't seem to make a difference.
I've also tried using the VC++6 IDE, and VS2010, but had no luck. I was able to debug the dllhost.exe in VS2010 and was able to hit some breakpoints, but the symbols weren't loaded properly. I tried compiling the DLL with debugging symbols and loading those to the VS2010 environment via the Debug settings menu, however that didn't resolve the issue.
I also didn't find the component services JIT Debugger to be very useful. I'd much prefer to just be able to debug in VB6.
What amazes me most is that this code is thousands of lines and has been maintained without the use of any debugger whatsoever. My young, spoiled self isn't ready to accept that this code can't be debugged.

How to deploy a Web Service from Xamarin Studio

Good afternoon, everyone.
I'm running Xamarin Studio (Mac OS) and I need to deploy a Web Service in order to build a safe communication with a MySql Database which my Xamarin.Forms app depends on
So far I've opened a new solution and added a new "Web Service with CodeBehind" from the ASP.NET Web Forms palette.
Now I have all template stuff: a DataWebService.asmx with a single line and a DataWebService.asmx.cs with an empty class inheriting from System.Web.Services.WebService.
Now, all I want is to learn how to deploy this Web Service so it can be imported by my other App and consumed.
(I do have a domain to deploy it to, but I won't mind localhost)
In order to make things as simple as possible, a HelloWorld application will do just fine.
----- Extra comments:
I suppose this is pretty much everything I'd have to do in Visual Studio, but I'm avoiding the need of another machine - even a virtual one, once I don't have a Windows license.
It seems to me that a wizard should be able to do the rest, but apparently there isn't such a thing in Xamarin Studio (which I'm hoping to be wrong)
The CodeBehindService.asmx.cs lacks the [WebService] directive I've seen on my research so far, which makes me think Xamarin Studio is still incomplete and can't support me in this task
I don't mind doing some work myself, though I'm not sure of what would be needed. My priority is: deploy
What I have: an almost empty asmx file; a dll binary
What do I do with it?
I tried simply uploading them but the "Add Web Reference" wizard asked for a discovery file; as you can see I lack the basics.

Classic ASP, IIS8 & VB6

I was hoping to get some people's expertise as I'm currently outside my main domain. I'm currently working for a client that has an old system written in VB6 COM Objects. They use these to do basic Database interaction. These COM Objects are used in a Classic ASP website.
I've been tasked with getting the site up, running and in a build-able environment (Windows 8.1 is what they want to use).
I've been working through all the blockers associated with this and I believe I have it in a running state (as in I've configured IIS and been able to run the website, log in and click around and so far nothing has crashed).
I can make changes to the code in Visual Studio 6 Enterprise and those changes are working so I'm confident I've got that about 90% of the way there.
I've now got 2 problems both somewhat related:
Problem 1:
Problem 1 is now debugging, both the ASP & the VB code.
I can put a break point in the VB code and 'Step-Into' it (to attach) and then run the site and the code that runs in the global.asa file gets run and hits that breakpoint no worries, can step through as I would expect.
The problem then comes when I go to 'login' to the system. I use the same user/password that works if I'm not 'attached' the system crashes with a "An unhandled exception ('Error in loading DLL') occurred in w3wp.exe [3284]." - If i try to load up a debugger from this Visual Studio 6 is not an option in the list. If I then detach and I can do everything as before.
Does anyone know what could be causing this? Or have another way to be able to debug/step through this?
Problem 2:
They had previously been 'running' the website through Visual InterDev 6.0 - they could add breakpoints to the Classic ASP code and be able to step through then into the VB components.
The problem is that although I can install InterDev on my machine, I can't actually set it up. It appears to need FrontPage Server Extensions which although they can be 'installed' on IIS 8.5 they don't seem to be officially supported by Microsoft. So I've managed to install it without any issues but it doesn't seem to be configured in the same way that InterDev needs it to be able to setup a solution file/run from it.
My Question is this: Has anyone been able to configure FrontPage Server Extensions in a way that InterDev works?
OR is there any other tools I could use to 'run' a Classic ASP site that would allow me to debug it properly.
Let me know if you need any more information.
Thanks in Advance,
Michael
I think you actually don´t need Interdev in order to debug the classic ASP code. Just create a blank solution in Visual Studio and add all the classic ASP files from the virtual directory (editor and debugging capabilities for classic ASP files are still supported, even in the latest version of Visual Studio).
I assume you run the web application in your local IIS... once you have the solution, open the script of interest, put some breakpoints and than attach the Visual Studio debugger to the web server´s worker process (which should be w3wp.exe). Maybe you need to manually select the Script code type (automatic code type detection might not work).

can azure web role instantiate an activeX component?

I have an asp.net website that I'm looking to migrate over to Azure. I have been doing some analysis of the website and code to understand issues with the migration. I am confident that 95% of the code will be fine as most of it is pretty standard web forms and dot net programming.
However, I have just run across an ActiveX component that is installed into the \windows directory on the webserver.
I am wondering if this will be an issue for the migration? There could easily be a number of follow-on questions as well depending on the answer. How do Azure web roles handle instantiation of activeX server components? Can I include the DSINTX.OCX file into the solution or do I wrap it in a dotnet assembly?
private DSINTXLib.Dsintx m_dsintx;
...
m_dsintx = new DSINTXLib.DsintxClass();
Installation of the ActiveX component should not be difficult. You can use a startup task running elevated to install it, assuming that there's an unattended installation mode for it. I blogged about this process for a Windows Service a while back.
http://blogs.msdn.com/b/golive/archive/2011/02/11/installing-a-windows-service-in-a-worker-role.aspx
If you don't have an installation file, then create a script that installs and registers the control and then use RDP to your role instance to debug. The blog post goes over some of these techniques as well. (Use notepad to create the command file, not VS.) You can add the OCX to your project, but be sure to set the Copy Local property to True so it becomes part of the package that is sent to Azure.

How do I use ASP.NET with Visual Studio 2008

I haven't used Visual Studio since VB 3 and am trying to give it a shot with ASP.NET. It seems that it should be able to connect to a website (via some sort of ftp like protocol I figure) and allow to edit without having to manually upload/download the files. Is this the way it is supposed to work or am I mis-understanding? I have tried using 'create new website' and 'open website' using my testing domain (hosted by godaddy, wondering if that may be the issue as well), each time it gives me errors. I'm not sure if I'm doing something wrong or trying to do something it wasn't meant to.
You really don't want to be working directly on a live web site, do you? That's just crazy. One little mistake and you've hosed the site.
Visual Studio now has it's own built in web server. You use that for testing. If you really don't want to use that you can put IIS on your local machine or set up a Dev/QA server somewhere. In that case, you'd edit it via a file share.
You should be using some kind of source control. Even for a single developer it's very important. When finished with a programming session, you check your updates back into source control.
Finally, only after the site's gone through a suitable QA process, the production server is updated from source control, not from within visual studio.
I would develop your website locally and ftp it to your godaddy website after or use the publish website feature in VS

Resources