ASP.NET Core 1.1 (Dynamic Controller Loading) - asp.net-core-mvc

I've done this before with WCF (using VirtualPathProvider), and again later with WebAPI2 (using DefaultHttpControllerSelector), to implement a plugin system for enterprise web applications that supports live updating. so I'm hoping their is a way to do this in ASP.NET Core 1.1, but I just haven't found the appropriate process yet.
What I would like to achieve is the following basic scenario. If an request fails to match an existing controller route, use the controller name provided by the request to probe a folder for a matching controller assembly. If a match is found load the assembly into the domain, and continue to process the request, otherwise just return a 404.
So far all my research has come up empty handed... but I'm completely new to .NET Core so there is still a lot I have to learn. While I continue my research, if anyone can provide any insight, I would greatly appreciate it.

Related

How to inject Mock Request Headers when using Apnet WebForms?

Is there any way to inject 'Mock' Request Headers for testing purposes when using Aspnet WebForms? I'm able to do this in my .NET CORE Projects using Middleware, but now I'd like to help a customer do the same thing with their Webforms project. I haven't worked with WebForms in many years, and I haven't found much online about this so far. I'm just looking for a starting point so I can investigate further. Thanks
Found Something here - will update later with my solution:
https://learn.microsoft.com/en-us/iis/configuration/system.webserver/httpprotocol/customheaders/

Host an ASP.NET Core MVC application in an Azure Function

I have tried searching for this online, but could not find an approach that works. There are a few helpful links to host a Web API but nothing related to a full fledged MVC app that consists of Controllers and Views. Azure currently does not have built in support for this. Hence, wondering if this is something doable.
It is possible to achieve this through the use of Custom Handlers. This blog post goes into further detail on how to create a custom handler. Do note that this feature is currently in preview so support is limited.

What is the purpose of adding services.AddMvc() in the ConfigureServices method in mvc 6?

Why is not enought to just add app.UseMvc() in the Configuration method in a mvc6 application? why it is also necessary to add the services.AddMvc() in the ConfigureServices method? and where can I find more info about this?
Thank you.
In this new ASP.NET 5 world there are two primary aspects of app development.
Dependency Injection. Aka what services are going to be required to run our application?
The application/request pipeline. Essentially the way we answer the question of "What to do when a request hits the server".
Due to these two primary concerns there then happens to be two mechanisms for tying into the system.
First, UseMVC is the way your application can say I want MVC to take a part in the request handling stage at "this" point. It's essentially a shortcut to an MVC specific middleware.
Second, AddMvc is the way your application says that you want the MVC services available to the system (needed in order for UseMvc) to work correctly. Therefore, if you were to try and do UseMvc without adding the corresponding MVC services the call would throw. Note that this adds the appropriate MVC services to the DI container.
Hopefully this answered your questions, for more information on it you can check out http://www.asp.net/vnext for more general information. For something more specific/video I did a talk a while back at Orchard conference where I go over several of the core pieces https://www.youtube.com/watch?v=kqgIByKn9Wk
Note: I gave the talk a while back, some concepts are outdated/may have changed but the core concepts are the same.

A good substitute for ASMX web service methods, but not a general handler

The best thing I like about ASP.NET MVC, is that you can directly call a server method (called action), from the client. This is so convenient, and so straightforward, that I really like to implement such a model in ASP.NET WebForms too.
However, in ASP.NET WebForms, to call a server method from the client, you should either use Page Methods, or Web Services, both of which use SOAP as their communication protocol (though JSON can also be used).
There is also another substitution, which is using Generic Handlers. The problem with them however is that, a separate Generic Handler should be written for each server method. In other words, each Generic Handler works like a simple method.
Is there anyway else to imitate MVC model in ASP.NET WebForms?
Please note that I can't change to MVC platform right now, cause the project at our hand is a big project and we don't have required resources and time to change our platform. What we seek, is a simple MVC model implementation for our AJAX calls. A problem that we have with Web Services, is the known problem of SoapException, and we're not interested in creating custom SoapExctensions.
You can mix ASP.NET MVC and ASP.NET Webforms in the same project. You'll just need to add the correct MVC parts to your current Webforms project and have the best of both worlds.
http://www.aspnetmvcninja.com/general/mixing-asp-net-mvc-and-webforms has a good walkthrough of all the steps you'll need to take to get it working.
You can splice your asp.net webforms app with something like Nancy perhaps?
I've had great success with Nancy and Knockout after I abandoned the horrible Ajax Control Toolkit.
(Apologies if I have misunderstood your question - I read it twice)

asp.net mvc 3.0 Global Filter for SSL pages

I’m in the process of creating a new C# asp.net mvc 3.0 project.
The web site will hold some public pages (such as: Home, about us, contact us, etc…) and hold some SSL enabled pages (such as: Login, Forgotpassword, Signup, in addition to all the pages in the application that the user will see after a successful authentication).
I’m curious to hear your thoughts (an opinion), before deciding on a particular approach.
I was thinking of using the Global Filter approach provided in MVC 3.0 in order to verify what are the pages being accessed…if the user is accessing public pages them make sure he’s in http:// if the user is accessing an SSL page then make sure it prints out the https://
Would the Global Filter approach be appropriate for what I’m trying to achieve?
Is there a good blog post for MVC 3.0 with such thing? (Currently googling).
Feel free to show me how or even propose an alternative.
Thanks
Sincerely
Vince
I believe this is what you are looking for...
http://weblogs.asp.net/jeffwids/archive/2010/08/19/how-to-switch-between-http-and-https-in-asp-net-mvc2.aspx

Resources