Reputation: 333
On my RouteConfig, I have Controller and Action name placed on the Default Route.
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Controller", action = "Index", id = UrlParameter.Optional }
);
While in page load, now the path is just 'http://geomig.com/'.
Is it possible to display full path, means 'http://geomig.com/Controller/Index' on page load.
Please help me.
Upvotes: 1
Views: 926
Reputation: 1380
You need rewrite the path using RewritePath() method.
Use the following link to know how RewritePath() works:
Example:
string originalPath = HttpContext.Current.Request.Path.ToLower();
if (originalPath == "/")
Context.RewritePath("/Home/Index");
Upvotes: 1
Reputation: 882
Remove the controller and action defaults. Simply have
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { id = UrlParameter.Optional }
);
Upvotes: 0