Click here to Skip to main content
15,888,351 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
when i am running individually a file (ex.cshtml) then it works correctly but when i make it as "set as start page" ,then it will give error of Server Error in '/' Application.

What I have tried:

the url before when it works is (http://localhost:01234/xyztables/ex) and after setting it as "set as start page" when it give error the url is (http://localhost:01234/Views/xyztables/ex.cshtml)
Posted
Updated 17-Jul-18 1:50am
v2
Comments
[no name] 17-Jul-18 7:25am    
To make any view as your landing page you have to set it to default in the route table. Did you tried that?
Member 13674211 17-Jul-18 7:49am    
in routconfig.cs routes.MapRoute(
name: "Default",

url: "{controller}/{action}/{id}",
defaults: new { controller = "xyz", action = "ex", id = UrlParameter.Optional }
);

1 solution

You don't navigate to view files directly. Set the start page in the project properties to be the controller and action that returns that view;

ControllerName/Actionname

The "set as start page" option is really for webforms projects, not mvc ones.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900