Routing in MVC application- Forcing route to go to MVC route rather than physical web form folder - asp.net-mvc-routing

I have solution with co-existing MVC and Web forms. I have a folder called New in my UI project with page as default.aspx.
By default mydomain/New lands me to tohis default.aspx page. Now i want to land it to MVC controller i have created.
New controller is: NewController and i want route all request like mydomain/New should land to this controller ignoring the physical file present in my project.
How can i do this?

Delete the physical page and folder. IIS won't send the request to MVC unless the physical path doesn't exist.

Related

Is it possible to create a MVC application that navigates like Facebook?

Facebook seems to have a single page where the content changes based on user interaction.
For example: If I click on somebody's post, the url changes to the user's profile/posts/.
Now I'm sure this is possible to implement on MVC.
Can somebody help me get started?
Perhaps some reference/sameple/tutorial (I believe this will heavily involve configuring the routings).
Sure, that's called Custom Routing. You can set up custom routing in the routeconfig.cs file in your project (for pre-MVC4, routing is in Gloabal.asax). Then you just use an Actionlink Helper to build your links.
Read More: http://www.codeproject.com/Articles/641783/Customizing-Routes-in-ASP-NET-MVC

How to create a url link to connect with another application from my application in wicket

In wicket how can I move using link in one application to another application. I had my application url like this http://test.examplefree.com/hellohomepage/details now I want to create an url link in my application. so that when I click on that link it can go to other application whose url is like http://test.examplefree.com/statusreport/homepage. Both the applications have same domain name, but the links are different. And my both applications are on three different servers like dev/test/prod. So I don't want to hard code the entire url, only the part of it, like /statusreport/homepage or /homepage/anyapplication.
I tried with
html
Click Me to go to next application
java
add(new ExternalLink("externalLink1", "/statusreport/homepage", "Click Me"));
I believe what you've done should work. What does it produce in the final HTML ?
Another way is to use RequestCycle.get().getUrlRenderer().renderFullUrl(Url.parse("/statusreport/homepage")).

Creating a page on CMS

For example:
I create a page on Joomla or Wordpress and then save it.
I create an entry in the menu that points to the new page.
When I select the new entry in the menu the page opens on the browser.
The URL that appears points to a file that doesn't exist on the server.
What is the mechanism that is used by a CMS like Joomla or wordpress to accomplish this?
This is typically done with a URL rewriting module that runs on the web server (mod_rewrite for Apache or URL Rewrite for IIS on Windows). It will rewrite a request URL like /blog/article-title to something like /index.php/blog/article-title or /index.php?q=blog/article-title before the website code even sees the request. Then, the code in index.php extracts the rest of the path and determines which content to serve based on that.
For Wordpress, see http://codex.wordpress.org/Using_Permalinks for some info about how the rewrites are set up.

Giving a link in a asp.net mvc2 page for a non-mvc page ie, a asp.net webform

I tried to give link to my reports located in Reports folder under "Views". My problem is that I am unable to direct from a mvc page to myReport since it is looking for that page in controller, which doesnt exist. I have the route given in global.asax. am i missing something here?
my mapping to web pages is as follows
aspx page (contains relative path to the application eg:
<siteMapNode url="Managers/FindUser.aspx" title="Find user"/>
is translated as :http://localhost/Managers/FindUser.aspx
mvc page
<siteMapNode url="Managers/Management/" title="Management" />
is translated as :http://localhost/Managers/Management/

MVC 2 Area Authentication Not Working

Using MVC 2, if I setup my root web.config with forms authentication (there is no locations section), and I go to a page outside an area (off of the root), I get redirected to the login page as one would expect. However, if I go to a page in an area, I don't get redirected as expected. Do I need an additional web.config somewhere in the area or do I possibly have something mis-configured?
Also, I have been sure to clear all cookies and start from a new session and browser just in case something was holding over from a previous login.
I really did not want to have to maintain locations or multiple web.config files since the whole site needs authentication.
If it helps, I am using Visual Studio 2010 and started with a MVC 2 template.
Warning: I have only had 2 cups of coffee this morning so it could be a short circuit between the chair and the keyboard...
Thanks,
--Patrick
Web.config authorization should not be used with an MVC application. Instead, apply the [Authorize] attribute to the controllers you wish to protect. If all of your controllers site-wide need authorization, consider having a BaseController with an [Authorize] attribute and having all of your controllers site-wide subclass the BaseController.