ASP.NET MVC as a desktop thick client application. Is it possible? - asp.net-mvc

I'm just curios whether such possibility exists.
Here what I mean:
Suppose I have an ASP.NET MVC site. And some classical .exe application which stores this site as a resource.
When user starts this application, server runs in the context of the process (without any outside exposure) and processes the requests from the same process. At the same time client sees generated content in a browser-like window.

You'll need
IIS Hostable Web Core to host website
http://blogs.msdn.com/b/carlosag/archive/2008/04/14/hostyourownwebserverusingiis7.aspx
WebBrowser Control to access site from your windows app
http://msdn.microsoft.com/en-us/library/system.windows.forms.webbrowser.aspx
http://msdn.microsoft.com/en-us/library/aa752041(v=vs.85).aspx

Related

Ask for username and password before loading ASP.NET MVC 5 application

I am running an ASP.NET MVC 5 application on a Windows 2019 server with IIS 10. Now I want to set the IIS to pop up a window asking for a specific user with password before loading the web application in the browser. It is important that the prompt appears before the application accepts the client's requests. So actually before the application is started on the web server.
I can remember that something like this used to be possible with a .htaccess file. Is it possible to implement this in IIS 10 with the Web.config file somehow? In my Web.config I have already entered a http to https rule. So it would not be a security leak, because the connection is encrypted. Is it possible to configure IIS to ask for a specific password and username before starting the web application?
Thanks.
As can also be seen in the comments under the question, there is no IIS build-in solution for this requirement. The integration of third-party software for this requirement has not been considered.

ASP.NET Core identity shared across browser

When I'm deploying an ASP.NET Core web application to Azure, I have an issue with the session : they are shared across browsers.
Explanation : I'm going to my deployed site, I log in with my email/password then I'm logged in. If I open the website in an other browser on the same machine or on an other machine, I'm now connected with the credentials I used in the first browser.
I deployed the default template from Visual Studio without any changes.
Is there something to do to resolve this issue or am I missing something ?
Pretty sure this functionality is by design... and it makes a lot of sense - you wouldn't want to have to re-authenticate if you opened another tab to view a document in your on-line banking would you?
If you need to logon without sharing the cookies with existing browser (it will be the cookies that are holding the reference to the session that ensures the server knows who you are) you need to start a new session. For Internet Explorer this is simply File >> New Session.
For Chrome it is a little more complicated but explained here... Separate session for each window

Http handler for classic ASP application for introducing a layer between client and server

I've a huge classic ASP application where in thousands of users manage their company/business data. Currently this is not multi-user so that application users can create users and authorize them to access certain areas in the system.
I'm thinking of writing a handler which will act as middle man between client and server and go through every request and find out who the user is and whether he is authorized to access the data he is trying to.
For the moment ignore about the part how I'm going to check the authorization and all that stuff. Just want to know whether I can implement a ASP.net handler and use it as middle man for the requests coming for a asp website? I just want to read the url and see what is the page user is trying to access and what are the parameters he is passing in the url the posted data. Is this possible? I read that Asp.net handler cannot be used with asp website and I need to use isapi filter or extensions for that and that can be developed only c/c++.
Can anybody through some light on this and guide me whether I'm in the right direction or not?
Note: To be specific, I cannot modify anything in the existing application because there are hundreds of pages (each page again has couple of different actions, such as posted to the same page again) are there in the system and it is really big mess and we are coming up with a different solution to clear that mess but that takes couple of years to complete, meanwhile to provide the multi-user functionality to the users we are trying to do this. This layer acts like layer where we authorize the user to do certain operation or access a page, nothing more than this.
I've worked with an ASP classic website that runs Javascript on the server side. In IIS we selected JScript as the server-side scripting language and access the session variables and the database simultaneously to check user's access rights when they try to check out various parts of the site. What you're describing is completely do-able. Each page needs to have Javascript in <% %> tags and that identifies the content as server-side code. Be careful with security though!
As for the ASP.NET handler, I also developed an ASP.NET application that I added imported to our site (had to use a .NET thread pool) which could handle Ajax requests. IIS has this option to import ASP.NET applications to your site.
You've got options.

ASP.NET MVC intranet application based on a workgroup

Is ASP.NET MVC intranet application intented only to be used as a Windows-domain based application or there's a possiblity to run it inside a workgroup?
Thanks!
The word Intranet has no correlation with any network operating system (Windows Domain, Workgroup, etc). How you build your web based application (using any language) is indifferent to who can access it. So to answer your direct question, you can use ASP.Net MVC to build a website that can be accessed by anyone on a local network if you configure the website and/or hosting environment (IIS) in that manner.
MVC (Model View Controler) is a way to develop application (web + desktop) and can be used as Windows-domain App or inside a workgorup or without of both

Is it possible to host an ASP.NET MVC2 website from a windows service?

I have a .NET 4 application that runs as a windows service. It runs periodic tasks and provides WCF restful webservices. It already hosts a silverlight web page (via WCF) that allows a user to configure the service.
Now I have a requirement to provide information on HTML/java script pages (e.g. for browsers and platforms that don't support Silverlight). I can serve simple HTML and javascript pages through WCF but that becomes laborious very quickly. I'd like to use MVC2.
Is it possible to provide MVC2 web pages from within a windows service? Or at least use some of the functionality provided by MVC like routing and the view engine?
Or is it more trouble than it's worth and should I head down the path of a separate app hosted on IIS?
You can host the ASP.NET runtime in any type of application including a Windows Service using the CreateApplicationHost method. Although note that by doing this you lose the robustness, security, logging, etc... that a real web server such as IIS provides.
Since you're asking the question about what route to take, I'd host an MVC2 application in IIS. Why recreate a web server using WCF when IIS is already there - and since you're asking, it sounds like that's a viable option.
I agree with Darin's answer that you can host ASP.NET MVC2 in any application, but I think you're going to end up recreating a lot of plumbing that's already in place with IIS.
On the upside, if you go with serving up ASP.NET MVC2 resources in a WCF service application, it may end up rocking and you could have a nice application you can sell on the side. :)

Resources