ColdFusion/ASP split URL handling - asp.net-mvc

I am working on a new ASP.NET MVC (IIS 7) application that needs to hang off the URL of an existing group of ColdFusion applications. The URL hosts a series of applications and is of the form:
http://myapps.com/allApps/<appNumber>/<appViews>
ColdFusion is currently handling all the applications on this URL. I need the new ASP.NET application to use the same URL format but have a specific <appNumber>. So for example, ColdFusion handles:
http://myapps.com/allApps/1/<appViews>
http://myapps.com/allApps/2/<appViews>
http://myapps.com/allApps/3/<appViews>
http://myapps.com/allApps/4/<appViews>
New ASP.NET app needs to handle:
http://myapps.com/allApps/5/<appViews>
I know how to use ASP routing to send the requests to my ASP app controller once my app is getting the requests, but I don't know how to tell IIS to send the specific URLs to my application so they are not processed by ColdFusion.

Unless you have IIS set up to pass ASP.NET pages to ColdFusion for processing, it should not matter.

Related

asp.net mvc routing depending on session

I have an ASP.Net MVC site and I want that every request to images of my site
/images/image_name.png
are redirected to
/images/{skin}/image_name.png
where {skin} is session dependant.
and I would like to make the same for any type of files (css, some json file for configurations,...)
I was asking if it is possible in ASP.Net MVC to hook requests at HttpListener level to make there the correct switch depending on the session.
Thanks a lot

MVC form application access from mobile device

I have this MVC web application that generates and return XML file as a result. I also have mobile application that gets xml file from MVC web application.
I have simplemembership as authentication for mvc web app and I want to use it with my mobile application without using web browser. How do I approach to implement such process?
One approach is to use basic authentication where you send the credentials in the header of the HTML request. You need to use SSL/HTTPS on the server to make this secure. Here is an article on how to use basic authentication with SimpleMembership.

How does IIS recognize that request is for MVC Controllers or webforms Pages?

When the Application pool receives a request, it simply passes the request to worker process (w3wp.exe) . The worker process “w3wp.exe” looks up the URL of the request in order to load the correct ISAPI extension. ISAPI extensions are the IIS way to handle requests for different resources. Once ASP.NET is installed, it installs its own ISAPI extension (aspnet_isapi.dll) and adds the mapping into IIS.
Si If that's true, my question is how does it recognize which extensions to be loaded
for that request?? MVC / Web Forms?
When and where does the IIS come to know that a request is for MVC or WebForms Application?
How framework decide which Modules should handle the request and decide to render page content or views in MVC.
hen and were the IIS come to know that request is for MVC or WebForms Application?
They are both ASP.NET applications so it doesn't need to recognize that. The aspnet_isapi.dll is perfectly capable of serving both types of applications (which are actually a single type called ASP.NET).
ASP.NET MVC is just a custom handler added to the ASP.NET pipeline.
That all is about the standard IHttpModule and IHttpHandler infrastructure. See complete description here Routing with ASP.NET Web Forms and here How ASP.NET MVC Routing Works and its Impact on the Performance of Static Requests

ASP.NET Web API - Authetication in Windows Forms Application

I developed a web system using ASP.NET MVC 4 and I must perform an integration using .NET Web API and Windows Forms Application.
So far everything has been fine, but now I need to authenticate the users using Windows Forms Application and this application will be open on the internet.
My application already contains users that are registered in the database and currently are authenticated using the component 'Authorize' of ASP.NET MVC.
For data consumption through the client (Windows Forms Application) currently I use the library Microsoft ASP.NET Web Client API.
How can I accomplish this task safely?
Does anyone have any suggestions?
You can extend the HttpClient to add authentication. One example can be found here. It shows how to add a HttpMessageHandler into your pipeline for authentication using OAuth.
Here is the complete List of ASP.NET Web API and HttpClient Samples
Take a look at this Q&A which describes creating a custom AuthorizeAttribute for Web API that also authenticates the user using http basic security and grabbing the credentials from the HTTP header. Note that there is a different AuthorizeAttribute for ASP.NET Web API (System.Web.Http.AuthorizeAttribute) as opposed to the one for an MVC controller (System.Web.Mvc.AuthroizeAttribute). They have different behaviors. You do not want a call to a Web API being redirected to a logon page.

why asp.net MVC controllers are not considered as RESTful web service

I have an asp.net web application, now let say a user send a POST action method to the application using following URL Myapplication.com/Customer/Edit/120, then this URL will update the customer who have ID=120 with the data sent.
So this is the same as calling a web service, since you are integrating with the application (in this case Update a customer) using URLs, so why this is not consider as having a RESTfull web service!
What exactly is a web service ? And how do you differentiate between a web page and web service.
These are just different terms of retrieving some Resource. Either with Web Service or Web Page, you are just requesting for a resource. The representation is fixed for web page i.e its always HTML. If from my web service instead of returning Json or XML , if it start serving HTML would then make it a web page ?
I think the whole concept of web service came with SOAP world. With Rest there is nothing as web service or web page. There are mere different representation for a resource(json, xml, html, image).
Further to answer your
so why this is not consider as having a RESTfull web service!
Microsoft has launched Asp.Net Web API, which is nothing but pure MVC to serve content.

Resources