how can use Application_BeginRequest event in c# window application - c#

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

Related

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".

Having c# windows application and web application together

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.

How to access same database by both asp.net web application and WPF desktop application

My question can be simple or easy. I have created two applications one is asp.net website and second is WPF Desktop application. Both are accessing same sql-server database. Question are:
What are the best hosting websites to register a website?
Once a website is registered how to access that SQL-server database placed on server by desktop application?
answers
Godaddy, bigrock, somee.com** are good hosting providers
Use the same ConnectionString in both website and WPF application.
Ideally you should develop an API and host it as a webservice somewhere (azure?) and let the webapp and wpf app access only that service, not the database directly.

Can I pass data directly between Cassini webserver and hosted ASP.NET child app?

I've got an application which for various reasons, has been created as a "website on CD" project. It uses Cassini as the webserver (running as a thread inside the main app) and a C# .NET browser application (which uses the WebBrowserEx control).
The application now has to use a barcode scanner which I cannot easily interface with from within the ASP.NET part of the app, so I was thinking of using a normal WinForms dialog for the barcode scanner, but then I need to pass the data to the ASP.NET app.
How can I do this?
I realise I could put the scanned barcodes in the URL (as CSV) but this seems a bit messy. Is there a way I can directly insert data into the ASP.NET session, or directly call methods in the hosted ASP.NET application or is this not possible? I'm just trying to think of the cleanest way to pass the data back to the ASP.NET app...
Add a WCF Service to the ASP.NET app, and consume it in the Forms App.

Creating C# windows service that is called by en event in the browser

I am a java developer and very new to C# and C++. I am trying to create a windows service in c# that another web application will call to close one of the projects in c++. I've created a dll file in c++ with a method to close the application.
I created a web service as specified in http://www.cjvandyk.com/blog/Articles/How-do-I--Create-a-Windows-Service-application-using-Visual-Studio-2010.aspx. However, I am not sure how to call this service from the web application.
Can someone advise me or refer me to some place where I can learn how to do this?
Not sure why you would want to go Windows service route. Your web application should be able to do everything on the server side.
If you have to use Windows service, you will need to expose some sort of service; e.g. wcf net.tcp service to accept calls for closing your app.
I would suggest you revisit your solution of using windows service.
You can try a software utility Application as Service by Eltima company. It lainchibg any application a s a service and offers different options. So If I've understood you right - it will help you.
http://download.cnet.com/Application-As-Service/3000-2094_4-10338474.html?tag=mncol;9

Categories

Resources