Search Results

Search found 202 results on 9 pages for 'maproute'.

Page 2/9 | < Previous Page | 1 2 3 4 5 6 7 8 9  | Next Page >

  • Discusses some issues related to mvc2.0

    - by hao123
    ???????????????,???????? ??: ???????:1????????2????????3???? ?????????????? ??????:1???????:http://demo.com/admin/News/index 2???????:http://demo.com/s7mmer/News/index 3?????:http://demo.com/News/index ??asp.net mvc1.0???????????,?????,??asp.net mvc2.0???Areas?? ??: ???????,?????????????Admin?areas,??VS?????????????areas????,????????????????? ??????????: 1?????????Areas???? 2??Areas ???????? 3?????,?Areas?????????MyAreaRegistration.cs ????: ?? using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using System.Web.Routing; namespace S7mmer.Web { public class AdminAreaRegistration : AreaRegistration { public override string AreaName { get { return "Admin"; } } public override void RegisterArea(AreaRegistrationContext context) { //?????????? context.MapRoute( "AdminController_default", "Admin/{controller}/{action}/{id}", new { controller = "Home", action = "Index", id = "" }, // Parameter defaults new string[] { "S7mmer.Web.Areas.Admin.Controllers" }//controllers????? ); } } public class S7mmerAreaRegistration : AreaRegistration { public override string AreaName { get { return "S7mmer"; } } public override void RegisterArea(AreaRegistrationContext context) { //?????????? context.MapRoute( "S7mmerController_default", "S7mmer/{controller}/{action}/{id}", new { controller = "Home", action = "Index", id = "" }, // Parameter defaults new string[] { "S7mmer.Web.Areas.S7mmer.Controllers" }//controllers????? ); } } public class WebSiteAreaRegistration : AreaRegistration { public override string AreaName { get { return "WebSite"; } } public override void RegisterArea(AreaRegistrationContext context) { //?????????? context.MapRoute( "WebSiteController_default", "{controller}/{action}/{id}", new { controller = "Home", action = "Index", id = "" }, // Parameter defaults new string[] { "S7mmer.Web.Areas.WebSite.Controllers" }//controllers????? ); } } } 4??Areas?????Admin????????NewsController.cs 5??NewsController.cs??public ActionResult Index()?????view,??? ???news????index.aspx 6????????Global.asax??,?Application_Start()????AreaRegistration.RegisterAllAreas(); protected void Application_Start() { AreaRegistration.RegisterAllAreas(); // RegisterRoutes(RouteTable.Routes); } ????? http://localhost:1108/admin/News/index,??????????! ??????????????????,???????????????,????

    Read the article

  • Routing to the actions with same names but different parameters

    - by zerkms
    I have this set of routes: routes.MapRoute( "IssueType", "issue/{type}", new { controller = "Issue", action = "Index" } ); routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults ); Here is the controller class: public class IssueController : Controller { public ActionResult Index() { // todo: redirect to concrete type return View(); } public ActionResult Index(string type) { return View(); } } why, when i request http://host/issue i get The current request for action 'Index' on controller type 'IssueController' is ambiguous between the following action methods: I expect that first one method should act when there is no parameters, and second one when some parameter specified. where did i made mistake? UPD: possible duplicate: http://stackoverflow.com/questions/436866/can-you-overload-controller-methods-in-asp-net-mvc

    Read the article

  • ASP.NET MVC 2 RC2 Routing - How to clear low-level values when using ActionLink to refer to a higher

    - by Gary McGill
    [NOTE: I'm using ASP.NET MVC2 RC2.] I have URLs like this: /customer/123/order/456/item/index /customer/123/order/456/item/789/edit My routing table lists the most-specific routes first, so I've got: // customer/123/order/456/item/789/edit routes.MapRoute( "item", // Route name "customer/{customerId}/order/{orderId}/item/{itemId}/{action}", // URL with parameters new { controller = "Items", action = "Details" }, // Parameter defaults new { customerId = @"\d+", orderId = @"\d+", itemId = @"\d+" } // Constraints ); // customer/123/order/456/item/index routes.MapRoute( "items", // Route name "customer/{customerId}/order/{orderId}/item/{action}", // URL with parameters new { controller = "Items", action = "Index" }, // Parameter defaults new { customerId = @"\d+", orderId = @"\d+" } // Constraints ); When I'm in the "Edit" page, I want a link back up to the "Index" page. So, I use: ActionLink("Back to Index", "index") However, because there's an ambient order ID, this results in the URL: /Customer/123/Order/456/Item/789/Index ...whereas I want it to "forget" the order ID and just use: /Customer/123/Order/456/Item/Index I've tried overriding the order ID like so: ActionLink("Back to Index", "index", new { orderId=string.empty }) ...but that doesn't work. How can I persuade ActionLink to "forget" the order ID?

    Read the article

  • How to mask tilde (~) character in C# MVC routing table?

    - by AC
    I'm moving my home-baked web site to MVC and got the trouble with url routing. The site already serves several links that contain tilde (~) character in the path; something like http://.../~files/... http://.../~ws/... and I want each of them are handled by separate controller, like filesController, wsController, so my route table looks like routes.MapRoute( "files", "~files/{*prms}", new { controller = "files", action = "index", prms = "" } ); routes.MapRoute( "ws", "~ws/{*prms}", new { controller = "ws", action = "index", prms = "" } ); ... but when I try to get the result I got the error saying "The route URL cannot start with a '/' or '~' character and it cannot contain a '?' character." As I understand those characters have the special meaning in ASP.net but is it possible to mask them somehow, at least tilde? Should I parse and route requests like this myself? What the best practice to handle urls like this? Thanks!

    Read the article

  • ASP.NET MVC Route Default values

    - by Sadegh
    hi, i defined two routes in global.asax like below context.MapRoute("HomeRedirect", "", new { controller = "Home", action = "redirect" }); context.MapRoute("UrlResolver", "{culture}/some", new { culture = "en-gb", controller = "someController", action = "someAction" }, new { culture = new CultureRouteConstraint() }); according to above definition, when user request mysite.com/ redirect action of HomeController should be called and in that: public class HomeController : Controller { public ActionResult Redirect() { return RedirectToRoute("UrlResolver"); } } i want to redirect user to second defined route on above, so also i specified default values for that and some Constraint for each of those. but when RedirectToRoute("UrlResolver") turns, no default values passed to routeConstraints on second route and No route in the route table matches the supplied values shows. update my CultureRouteConstraint: public class CultureRouteConstraint : IRouteConstraint { bool IRouteConstraint.Match(HttpContextBase httpContext, Route route, string parameterName, RouteValueDictionary values, RouteDirection routeDirection) { try { var parameter = values[parameterName] as string; return (someCondition(parameter)); } catch { return false; } } } now values parameter haven't culture key/value, but route parameter have that.

    Read the article

  • problem with routing/T4MVC Url.Action()

    - by VinnyG
    I have these 2 routes : routes.MapRoute("Agenda", ConfigurationManager.AppSettings["eventsUrl"] + "/{year}/{month}", MVC.Events.Index(), new { year = DateTime.Now.Year, month = DateTime.Now.Month }); routes.MapRoute("AgendaDetail", ConfigurationManager.AppSettings["eventsUrl"] + "/{year}/{month}/{day}", MVC.Events.Detail(), new { year = DateTime.Now.Year, month = DateTime.Now.Month, day = DateTime.Now.Day }); And it work perfectly with this code : <a href="<%= Url.Action(MVC.Events.Detail(Model.EventsModel.PreviousDay.Year, Model.EventsModel.PreviousDay.Month, Model.EventsModel.PreviousDay.Day))%>" title="<%= Model.EventsModel.PreviousDay.ToShortDateString() %>"><img src="<%= Links.Content.images.contenu.calendrier.grand.mois_precedent_png %>" alt="événement précédent" /></a> Except when I get to do the link to today, if it's today, il will point only to www.myurl.com/agenda, witch is the value of CnfigurationManager.AppSettings["eventsUrl"]. What am I doing wrong? It's like if it's today, it point bak to the default agenda... Thanks for the help!

    Read the article

  • Where to call RouteDebugger.RewriteRoutesForTesting() when route registration is injected?

    - by boris callens
    As Phil Haack explains on his blog entry, the Route Debugger helps visualizing your routing tables. My site however gets it's routing injected by the MVCTurbine dependency injection (using Unity) like so: public class DefaultRoutRegistration : IRouteRegistrator { public void Register(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( "Accounts", "Accounts/{userName}/{action}", new { controller = "Account", action = "Index" } ); routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = "" } // Parameter defaults ); RouteDebug.RouteDebugger.RewriteRoutesForTesting(RouteTable.Routes); } } Where exactly can I throw in the the RouteDebug.RouteDebugger.RewriteRoutesForTesting(RouteTable.Routes); to rewrite my routing table?

    Read the article

  • MVC ActionLink generating NON-Restul URL AFTER adding constraints

    - by brianstewey
    Hello I have a custom route that without constraints generates a Restful URL with an ActionLink. Route - routes.MapRoute( "Blog", // Route name "Blog/{d}/{m}/{y}", // URL with parameters, new { controller = "Blog", action = "Retrieve" } Generates - http://localhost:2875/Blog/12/1/2010 From - <%=Html.ActionLink("Blog Entry - 12/01/2010", "Retrieve", "Blog", new { d = 12, m = 01, y = 2010 }, null)%> If I add constraints like so. routes.MapRoute( "Blog", // Route name "Blog/{d}/{m}/{y}", // URL with parameters, new { controller = "Blog", action = "Retrieve" }, new { d = @"\d{2}", m = @"\d{2}", y = @"\d{4}" } It generates - http://localhost:2875/Blog/Retrieve?d=12&m=1&y=2010 Extra information: it is added before the custom route. Any ideas? Cheers

    Read the article

  • Search Route in ASP.NET MVC

    - by olst
    Hi. I have a simple search form in my master page and a serach controller and view. I'm trying to get the following route for the string search term "myterm" (for example): root/search/myterm The form in the master page : <% using (Html.BeginForm("SearchResults", "Search", FormMethod.Post, new { id = "search_form" })) { %> <input name="searchTerm" type="text" class="textfield" /> <input name="search" type="submit" value="search" class="button" /> <%} %> The Controller Action: public ActionResult SearchResults(string searchTerm){...} The Route I'm Using : routes.MapRoute( "Search", "search/{term}", new { controller = "Search", action = "SearchResults", term = (string)null } ); routes.MapRoute( "Default", "{controller}/{action}", new { controller = "Home", action = "Index" } ); I'm always getting the url "root/search" without the search term, no matter what search term I enter. Thanks.

    Read the article

  • ASP.NET MVC 2 Areas 404

    - by Justin
    Hey, Has anyone been able to get the Areas in ASP.NET MVC 2 to work? I created a new Area called "Secure" and placed a new controller in it named HomeController. I then Created a new Home/Index.aspx view. However, when I browse to http://localhost/myapp/Secure/ it gives a 404 resource cannot be found. http://localhost/myapp/Secure/Home gives the same error. My area registration looks like this: public override void RegisterArea(AreaRegistrationContext context) { context.MapRoute( "Secure_default", "Secure/{controller}/{action}/{id}", new { action = "Index", id = UrlParameter.Optional } ); } I also tried this: public override void RegisterArea(AreaRegistrationContext context) { context.MapRoute( "Secure_default", "Secure/{controller}/{action}/{id}", new { controller = "Home", action = "Index", id = UrlParameter.Optional } ); } Thanks, Justin

    Read the article

  • Creating meaningful routes in wizard style ASP.NET MVC form

    - by R0MANARMY
    I apologize in advance for a long question, figured better have a bit more information than not enough. I'm working on an application with a fairly complex form (~100 fields on it). In order to make the UI a little more presentable the fields are organized into regions and split across multiple (~10) tabs (not unlike this, but each tab does a submit/redirect to next tab). This large input form can also be in one of 3 views (read only, editable, print friendly). The form represents a large domain object (let's call it Foo). I have a controller for said domain object (FooController). It makes sense to me to have the controller be responsible for all the CRUD related operations. Here are the problems I'm having trouble figuring out. Goals: I'd like to keep to conventions so that Foo/Create creates a new record Foo/Delete deletes a record Foo/Edit/{foo_id} takes you to the first tab of the form ...etc I'd like to be able to not repeat the data access code such that I can have Foo/Edit/{foo_id}/tab1 Foo/View/{foo_id}/tab1 Foo/Print/{foo_id}tab1 ...etc use the same data access code to get the data and just specify which view to use to render it. My current implementation has a massive FooController with Create, Delete, Tab1, Tab2, etc actions. Tab actions are split out into separate files for organization (using partial classes, which may or may not be abuse of partial classes). Problem I'm running into is how to organize my controller(s) and routes to make that happen. I have the default route {controller}/{action}/{id} Which handles goal 1 properly but doesn't quite play nice with goal 2. I tried to address goal 2 by defining extra routes like so: routes.MapRoute( "FooEdit", "Foo/Edit/{id}/{action}", new { controller = "Foo", action = "Tab1", mode = "Edit", id = (string)null } ); routes.MapRoute( "FooView", "Foo/View/{id}/{action}", new { controller = "Foo", action = "Tab1", mode = "View", id = (string)null } ); routes.MapRoute( "FooPrint", "Foo/Print/{id}/{action}", new { controller = "Foo", action = "Tab1", mode = "Print", id = (string)null } ); However defining these extra routes causes the Url.Action to generate routs like Foo/Edit/Create instead of Foo/Create. That leads me to believe I designed something very very wrong, but this is my first attempt an asp.net mvc project and I don't know any better. Any advice with this particular situation would be awesome, but feedback on design in similar projects is welcome.

    Read the article

  • MVC ActionLink omits action when action equals default route value

    - by rjygraham
    I have the following routes defined for my application: routes.MapRoute( "Referral", // Route name "{referralCode}", // URL with parameters new { controller = "Home", action = "Index" } // Parameter defaults ); routes.MapRoute( "Default", // Route name "{controller}/{action}", // URL with parameters new { controller = "Home", action = "Index" } // Parameter defaults ); And I'm trying to create an ActionLink to go on the Index action on my AdminController: @Html.ActionLink("admin", "Index", "Admin") However, when the view is executed the ActionLink renders as (Index action value is omitted): <a href="/Admin">admin</a> Normally this would be ok, but it's causing a collision with the "Referral" route. NOTE: If I instead use ActionLink to render a different action like "Default," the ActionLink renders correctly: <a href="/Admin/Default">admin</a> The fact that the "Default" action renders correctly leads me to believe the problem has to do with the default value specified for the route. Is there anyway to force ActionLink to render the "Index" action as well?

    Read the article

  • Urlredirect in MVC2

    - by Ken
    In global.asax routes.MapRoute( "Test_Default", // Route name "test/{controller}/{action}", // URL with parameters new { } ); routes.MapRoute( "Default", "{universe}", new { controller = "notfound", action = "error"} ); I have a controller: Home, containing an action: Index Enter the url in browser: h**p://localhost:53235/test/home/index Inside the index.aspx view in <body> tag: I want to link to the second route. <%=Html.RouteLink("Link", new { universe = "MyUniverse" })%> Shouldn't this generate a link to the second route in Global.asax? The generated url from the above is: h**p://localhost:53235/test/home/index?universe=MyUniverse. I can only get it to work, if I specify the name of the route: <%=Html.RouteLink("Link", "default", new { universe = "MyUniverse" })%> Am I missing something?

    Read the article

  • asp.net mvc 2: SportsStore application: The current request for action is ambiguous

    - by dotnet-practitioner
    I am working on SportsStore example on chapter 4 from the following book and getting stuck... Pro Asp.net mvc framework I get the following error: The current request for action 'List' on controller type 'ProductsController' is ambiguous between the following action methods: System.Web.Mvc.ViewResult List() on type WebUI.Controllers.ProductsController System.Web.Mvc.ViewResult List(Int32) on type WebUI.Controllers.ProductsController .. My router code looks as follows: public static void RegisterRoutes(RouteCollection routes) { routes.MapRoute( null, // Route name "", // URL with parameters new { controller = "Products", action = "List", page=1 } ); routes.MapRoute( null, // Route name "Page{page}", // URL with parameters new { controller = "Products", action = "List" }, // Parameter defaults new { page = @"\d+" } ); } and controller code looks as follows: public ViewResult List() { return View(productsRepository.Products.ToList()); } public ViewResult List(int page) { return View(productsRepository.Products .Skip((page - 1) * PageSize) .Take(PageSize) .ToList()); } What am I missing? my url is as follows: http://localhost:1103/ or http://localhost:1103/Page1 or http://localhost:1103/Page2 thanks

    Read the article

  • ASP.NET MVC Routes

    - by MVCDummy09
    Can I see one example that would make this piece of code compile? public IEnumerable<RouteBase> Routes { get { return new List<Route>() { new Route(...) } } } What would you do if RouteCollection.MapRoute() didn't exist? I'm trying to put my Controller in charge of mapping routes, not Global.asax.cs. public IEnumerable<RouteBase> Routes is a member of my Controller. If the Controller is responsible for a Route, it's a bad idea to decouple the Route by using routes.MapRoute() in Global.asax.cs.

    Read the article

  • Confusion about MVC Routes

    - by yang
    What is the problem below? routes.MapRoute( "Default2", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = "test" } // Parameter defaults ); routes.MapRoute( "Default1", // Route name "{controller}/{action}/{name}", // URL with parameters new { controller = "Home", action = "Report", name = "" } // Parameter defaults ); When I navigate to /home/index "id" parameter takes the default value of "test" but when I navigate to home/report the name parameter is null. In short, if the route definition is the first in the route table, then the parameter takes its default value. But the others below don't.

    Read the article

  • Why can't I publish MVC project

    - by Vnuk
    I'm having problems publishing my MVC project. When I do publish and upload everything to web server I get this: [InvalidOperationException: The view 'Index' or its master could not be found. The following locations were searched: ~/Views/Home/Index.aspx ~/Views/Home/Index.ascx ~/Views/Shared/Index.aspx ~/Views/Shared/Index.ascx] Weird thing is that Index.aspx exists in ~/Views/Home/, but IIS cannot find it there. If I copy entire project to web server and let asp.net compile it on the fly it works like a charm. My routing code: routes.MapRoute( _ "Default", _ "{controller}/{action}/{id}", _ New With {.controller = "Home", .action = "Index", .id = ""} _ ) routes.MapRoute("Root", "", New With {.controller = "Home", .action = "Index", .id =""}) I'm using IIS7 on Windows 2008 Web server. ASP.NET MVC 1.0, Visual Studio 2008. I've tried it local with IIS7 on Windows 7 - same error.

    Read the article

  • How to deploy ASP.NET MVC application in a shared hosting without losing the beautiful uri?

    - by ZX12R
    i am trying to upload an asp.net mvc application in a shared server. I don't have access to IIS. What i have done after reading from various sources is change the route method in the global.asax file as follows routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( "Default", "{controller}.aspx/{action}/{id}", new { action = "Index", id = "" } ); routes.MapRoute( "Root", "", new { controller = "Home", action = "Index", id = "" } ); it is working fine. but the problem is i have lost the beautiful uri here. is there a way to remove the ".aspx" behind the controller..? thanks in advance.:)

    Read the article

  • ASP.Net MVC Outbound Route Matching Problem When Using ActionLink

    - by Godders
    Hi there, Hoping for some help after reading into MVC routing and not coming up with the answer myself. I have the following routes registered: public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( null, "YourFeedback/Article/{resourceId}", new { controller = "YourFeedback", action = "Index", contentTypeId = new Guid(ConfigurationManager.AppSettings["ArticleLibraryId"]) }); routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = "" } // Parameter defaults ); } I have the following ActionLink in an aspx view: <%=Html.ActionLink("Your Feedback", "Article", "YourFeedback", new { resourceId = Model.ContentId.ResourceId }, new { @class = "yourFeedback" })%> My understanding of MVC routing is that this would render a anchor link with href of "/YourFeedback/Article/101" where 101 comes from Model.ContentId.ResourceId. Yet the anchor link href is rendered as "YourFeedback/Article/resourceId=101". Any ideas where I'm going wrong? Thanks in advance.

    Read the article

  • ASP.NET MVC: Routing

    - by JamesBrownIsDead
    Let's say I have this Controller: public class GlobalizationController : Controller { public JavaScriptResult GlobalizedLabels(string virtualPath) { return new JavaScriptResult(); } } I want the controller to handle (i.e. invoke from) any of the relative URLs below: /globalization/~Enlargement/Controls/Container.ascx /globalization/test/foobar.aspx /globalization/HappyTimes/Are/Right/Now What would my entry in global.asax routes.MapRoute() entry look like? As in... routes.MapRoute("Globalization", "globalization/{virtualPath}", new { controller = "Globalization", action = "GlobalizedLabels" }); The URL pattern "{virtualPath}" is wrong. What should it be?

    Read the article

  • Simple ASP.NET MVC Routing question

    - by Robert
    Hi there, I have two pages in my simple MVC App with two defined routes: routes.MapRoute( "Results", // Route name "Results/{id}", // URL with parameters new { controller = "Results", action = "Index", id = "" } // Parameter defaults ); routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Main", action = "Index", id = UrlParameter.Optional } // Parameter defaults ); I needed to have the results page load with just a product ID such as this: [MyDomain....]/Results/12345. But also the main page does a POST (using JQuery) to the Results Controller for updates using this route: [MyDomain....]/Main/Update along with a data bag. This works fine when I only have the "Default" route. But when I added the other "Results" route, all the POST calls to update are failing. Any ideas what I'm doing wrong??? Thanks a lot.

    Read the article

  • Images' site don't loading with a specific url in mvc

    - by Ivan90
    Hi guys, I'm using ASP.NET MVC 1.0 and I try to create a personal blog! I have a problem with an url that it has to show all post wrote in a specific year and specific month. My url is look like(http://localhost:2282/Blog/Archive/2010/5). So... it work correctly, infact it show all record that have year=2010 and month=5 but my problem is that when I use this url, images in total my site are no longer loading. I have this problem only with this url's type. I think that the problem maybe is my maproute? routes.MapRoute( "ArchiveRoute", "Blog/Archive/{anno}/{mese}", new { controller = "Blog", Action = "Archive",anno = @"\d{4}", mese = @"\d{2}" } ); Why images don't loading with this url? Thanks

    Read the article

  • I can't get areas working in VS2010

    - by devlife
    I just upgraded from VS2010 RC to RTM. Now my areas aren't working. I have a Profile area with a Home controller and an Action method Index(). If I try: http://localhost:4951/profile I get a 404 error saying that the resource can't be found. If I try http://localhost:4951/profile/home I get the same error. However, if I try http://localhost:4951/profile/home/index then the view is returned. Here is my ProfileAreaRegistration: public class ProfileAreaRegistration : AreaRegistration { public override string AreaName { get { return "Profile"; } } public override void RegisterArea(AreaRegistrationContext context) { context.MapRoute( "Profile_Unlock", "Profile/Unlock/{userID}/{unlockID}", new { controller = "Unlock", action = "Index" }, new { userID = new GuidRouteConstraint(), unlockID = new GuidRouteConstraint() } ); context.MapRoute( "Profile_default", "Profile/{controller}/{action}/{id}", new { action = "Home", id = UrlParameter.Optional } ); } Does anyone know what is going wrong?

    Read the article

  • What am i doing wrong with this in asp.net-mvc?

    - by Pandiya Chendur
    I gave this in my site.master <li><%= Html.ActionLink("Material", "Index", "Material")%></li> But my link doesnt seem to get my material controller Index method... I have this in my global asax file, public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( "Default", "{controller}/{action}/{id}", new { controller = "Home", action = "Index", id = "" } ); routes.MapRoute( "Default", "{controller}/{action}/{id}", new { controller = "Material", action = "Index", id = "" } ); } My controller: public class MaterialController : Controller { // // GET: /Material/ Material material = new Material(); public ActionResult Index() { var materials = material.FindAllMaterials(); return View(); } } What am i doing wrong.... When i click the link i get The resource cannot be found. error.. Any suggestion...

    Read the article

  • Cannot see index view of my controller - routing related

    - by olst
    Hi. I have a controller named Content, which has an Index action, which is associated with a view. I would like the simple route "content" to show me the index view of the content controller, so I use the following code (with the addition of the default site home route): routes.MapRoute( "ContentIndex", "content", new { controller = "Content", action = "Index"} ); routes.MapRoute( "Default", "{controller}/{action}", new { controller = "Home", action = "Index" } ); when I type the url : "http://localhost/content/", I get an error 404 saying the resource cannot be found, but when I type "http://localhost/content/index", it shows the content index view. How can I get rid of the index in the url ? Thanks !

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9  | Next Page >