Having c# windows application and web application together - c#

I have one windows application developed in c# and one web application developed in asp.net and MVC. Now i want a mechanism like when i press button in windows application it should open this web application preferably in IIS it self so that my web application is viewed in browser. kindly help with this as my final year project is pending due to this

You just have to open the URL of the Web server.
See: How to open in default browser in C#
System.Diagnostics.Process.Start( "http://google.com" );

The way to do this is to first host your web app and provide it URL to the button click like
Response.Redirect("Your URL");
If use want to test this before having your web app hosted , You have to put both the project in one Solution and in Properties of it you need to set both the projects as startup project. No doubt your web app will also open but for time being you can ignore that window and can check whether the redirecting of URL is working.

Related

How to display and open installed applications on local machine using asp.net web application

How to display and open installed applications on local machine using asp.net web application
I want to show the list with a dropdown menu and when I click on any application that application should open.
If I understand your question properly, the answer is "You can't."
Reason: Your web application is sand boxed due to security reasons.
Think of it like this: You don't want Facebook to find all your installed applications to figure out what ads to show you. You don't want any malicous site to figure out which applications you have installed to exploit a security error in application X.

How to call Windows form from .net web application

i have a windows application and now we want to upgrade it to web application.
Is there any way to use same forms from web application
to avoid duplicate work to develop same page in web application.
i want to open windows form on one click from web form. please provide any sample code if possible.
It's not something you can do automatically. You can reuse your business logic behind the application but you have to write a new UI from scratch. You can also try to use some automated tools but to be honest in most cases you will have to put significant amount of work to get your application working the same as window windows application. You must consider and implement new security policy regarding data transfer/presentation in your web app.
As Adjorem said, simply, no. Even if you find a converter it will probably make a mess and you'll need to do a lot of refactoring.
To open your windows app from web app:
You can register your own url protocol to start your application, e.g myfancyapp.
On your website you can create an href="myfancyapp://...". You can parameterize your windows app through a downloadable file with startup infos.
See:
How do I register a custom URL protocol in Windows?
If you want, you can check, if your app is installed with the help of fonts. Install a font (with a special name) with your app installer. You can then check if font is available on your website and display a message "Please install windows app first".

How to connect a separate webpage opened from a shortcut to a main web app? (.NET)

I'm opening up a specific page from my web app via a shortcut (a url the user saves and can send/email). When the user opens the shortcut, I need to connect the opened window to the main web app if they have it open. I can check a cookie to see if the main web app is up, but I'm not sure how to actually establish a link between the two windows without redirecting/closing the new window. Im using .NET framework 4.7.x

how can use Application_BeginRequest event in c# window application

I have developed c# windows application and I want to use ASP.NET code like
Application_BeginRequest event in window application for trace URL.
Is it possible or not?
For the purpose you will need to host the asp.net web service outside of the IIS, because you have windows application.
That is possible by making your windows application also self hosting using OWIN/Kataina. For more information here

How to Restart MVC4 project Programmatically

I need to restart my mvc4 web application programmatically. But System.Web.HttpRuntime.UnloadAppDomain() doesn't work.
What is the best way to restart asp.net mvc application? Please mind that changing web.config content or folder names doesn't solve my problem.
this code work for me. just call it to reload application.
System.Web.HttpRuntime.UnloadAppDomain();
More info
This method will just unload our application. If you just put this method in an ASP.NET web button you are totally done. So when will our application reloaded? Actually if you click your button it will first launch our method and unload application. Further on the web page we are on at that moment will be reloaded as well, because we just clicked a button and the web page should refresh. After launching our method the page refresh process will cause our application to reload as well.
EDIT - After looking at comment on OutputCache in the question, You can invalidate OutputCache programmatically, Check this out
If still you want to Restart IIS or AppPool then you can follow these resources -
Programmatically start/Stop a Website in IIS
Restart IIS7 in C# using iisreset.exe and
System.Diagnostics.Process
Recycle ApplicationPool for IIS in C#

Categories

Resources