Avoid to write Long URL in Browser
In this article all screen shots are based on " How to avoid to write long URL in Browser to Run your MVC Project ".
First create your MVC Project as i discussed in my Previous Artical. After createing your MVC Web Application project with default files and folders as per the Template Selection.
Now Visual Studio created our project in place and the solution file looks like ,
In Solution Explorer there is a folder name is App_Start.In this folder there is a .cs file whose name is RouteConfig.cs open this file and configure the Setting .
By Default RouteConfig.cs file have default setting like this..
Now you have to Configure RouteConfig.cs file First Copy and Past the default code and configure the code according to your Controller Name, View Name and URL .
If you want to run your project after giving any URL like /HOME then......follow the Image below.
1. In name tag give any name but it must be UNIQUE with other.
2. In url tag give any name which you want give in browser after slash"/" like ----> url="Home"
now after run your project give URL like localhost:39876/Home press enter
3. In defaults tag give Controller name and View name.
2. In url tag give any name which you want give in browser after slash"/" like ----> url="Home"
now after run your project give URL like localhost:39876/Home press enter
3. In defaults tag give Controller name and View name.
Suppose if you dont want to give any extra URL like /Home ..etc as i shown above.
then there is a tag whose name is url left them blank like url="" only and do all the configuration same as show above images.
Only this much you have to do according to your requirement.Now do your configuration and feel free to run your project without giving url
then there is a tag whose name is url left them blank like url="" only and do all the configuration same as show above images.
Only this much you have to do according to your requirement.Now do your configuration and feel free to run your project without giving url

0 comments:
Post a Comment