But i also have a Web Form that i call "Merchants", i need to place this web form just under the MVC to make the URL look like this http://localhost:81/Merchants
My problem is IIS is trying to look into the MVC controller for the "Merchants" which does not exist, i want hopefully if possible that if the URL points to http://localhost:81/Merchants it will go to the Web Form,
otherwise it will go the the usual Controller.
I hope someone can help me,
Thanks
JFRBPH12™
It's more fun in the Philippines :)
http://www.philippinetourismusa.com/
But i also have a Web Form that i call "Merchants", i need to place this web form just under the MVC to make the URL look like this http://localhost:81/Merchants
My problem is IIS is trying to look into the MVC controller for the "Merchants" which does not exist, i want hopefully if possible that if the URL points to http://localhost:81/Merchants it will go to the Web Form,
otherwise it will go the the usual Controller.
According to your description, I suggest you could consider changing the RegisterRoutes method in MVC with adding a new route.
Codes as below:
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapPageRoute("Merchants",
"Merchants",
"~/Merchants.aspx");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
After adding this routes, the application will firstly check the url is "xxxxxx/Merchants", if it is end with "Merchants", it will firstly redirect the page to "Merchants.aspx".
Then it will use the second routes to map the mvc controller.
More details about how to use route for web form, you could refer to this
article.
Best Regards,
Brando
.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
Member
243 Points
566 Posts
IIS Add Application under MVC
Jan 09, 2018 01:33 AM|johnjalani|LINK
Hi,
I have an MVC app hosted in my local IIS that looks like this http://localhost:81/Home/Login
But i also have a Web Form that i call "Merchants", i need to place this web form just under the MVC to make the URL look like this http://localhost:81/Merchants
My problem is IIS is trying to look into the MVC controller for the "Merchants" which does not exist, i want hopefully if possible that if the URL points to http://localhost:81/Merchants it will go to the Web Form, otherwise it will go the the usual Controller.
I hope someone can help me,
Thanks
It's more fun in the Philippines :)
http://www.philippinetourismusa.com/
Star
9831 Points
3120 Posts
Re: IIS Add Application under MVC
Jan 10, 2018 02:17 AM|Brando ZWZ|LINK
Hi johnjalani,
According to your description, I suggest you could consider changing the RegisterRoutes method in MVC with adding a new route.
Codes as below:
After adding this routes, the application will firstly check the url is "xxxxxx/Merchants", if it is end with "Merchants", it will firstly redirect the page to "Merchants.aspx".
Then it will use the second routes to map the mvc controller.
More details about how to use route for web form, you could refer to this article.
Best Regards,
Brando