2
голосов
2ответов
2623 просмотров

Asp.Net MVC Default Route

I have my default route defined like this routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Home", action = "Ind...

3
голосов
1ответов
1437 просмотров

ASP.NET MVC Action Method Parameters from Querystring don't change after first request

I have an action method in a controller that needs to do paging. I am passing a page number and pagesize parameter in the querystring. The problem I am having is that the first request I make sets the parameters for all subsequent calls. public ActionResult GetStuff(string key, int? page, int? p...

1
голосов
2ответов
832 просмотров

Can I have more than one "Details" ActionResult in a controller?

I have a Controller called TicketsController.vb, with an action result of: ' ' GET: /Tickets/Details/5 Public Function Details(ByVal id As Integer) As ActionResult ViewData("OpenTixCount") = ticketRepository.countOpenTickets.Count() ViewData("UrgentTixCount") = ticketRepository.countUrge...

0
голосов
2ответов
1801 просмотров

href path in aspx files in area

I am continually testing the new feature of ASP.NET MVC 2 Preview 2 called: "Areas within one project". Currently I have a problem with linking to css and js files from within aspx code. When the url points to an url without the id, everything works fine: http://mysite.com/area/controller/ac...

0
голосов
1ответов
585 просмотров

Basic MVC routing: /FolderName/FolderName/ControllerName

I have a topLevel folder with a subFolder holding ControllerName. When I enter: http://localhost/FolderName/FolderName/ControllerName how do i tell mvc to account for the folder depth? thx

0
голосов
1ответов
489 просмотров

skip or disable links to current path in ASP.NET MVC

I'm writing an helper that basically receives many RouteValueDictionary and returns many links; I'd like to skip links to the current route values (example: in /Products/Details/3 there should not be a link to /Products/Details/3), ignoring other URL params if any. What I can think of is to chec...

8
голосов
5ответов
3469 просмотров

Html.ActionLink construct wrong link when a non-mvc route is added

I have an application here with a mix of webform and mvc. I specify the routing as below routes.Add("AspxRoute", new Route("Upload/New", new WebFormRouteHandler<Page>("~/Uploads.aspx"))); routes.MapRoute( "Default", ...

1
голосов
2ответов
807 просмотров

Can I serve images in ASP.NET MVC application from Views directory

I have some pages designed by someone else as simple HTML that I need to dump into my MVC application. Not surprisingly the images are stored in a local /images directory. I'd like to be able to serve the images up from the Views directory where the main view pages are. I'd rather do this tha...

0
голосов
2ответов
542 просмотров

ASP.NET MVC: action methods with one param not named ID and non-integer

Consider an ASP.NET MVC 1.0 project using the Areas convention as described on this Nov. 2008 Phil Haack blog post. This solution works great once it's set up! My trouble is starting thanks to my limited knowledge of ASP.NET MVC's routing rules. My intention is to create an action method and U...

12
голосов
2ответов
2225 просмотров

How to have folder and controller with same name in ASP.NET MVC?

I have a MVC controller called Downloads. http://mysite/Downloads I also want to put a physical file in a physical folder called http://mysite/Downloads/MyFile.zip. If I simply create a folder, I get a 403 when browsing to http://mysite/Downloads. (Most likely because of directory browsing is d...

2
голосов
4ответов
4151 просмотров

How to get Html.BeginForm to GET to correct MVC Route

In my ASP.NET MVC application I have the following GET input field: <% using (Html.BeginForm("Search", "Products", FormMethod.Get) { %> <input type="text" name="searchQuery" id="searchQuery" /> <% } % I want this to go to the route: routes.MapRoute("ProductSearchRoute"...

12
голосов
1ответов
6206 просмотров

Remove or replace existing routes in RouteTable

I got a ASP.NET MVC 2.0 Preview 1 app and started to create some areas which contains their own routes. I want to have a way to overwrite these routes in the main project. I can of course not add a new route with the same name. I can see the RouteTable.Routes.Remove(RouteBase item) but not sure ...

1
голосов
3ответов
2361 просмотров

ASP.NET MVC custom routes with optional args

I want a Route with two optional args; I thought the following would work: routes.MapRoute( "ProductForm", "products/{action}/{vendor_id}_{category_id}", new { controller = "Products", action = "Index", vendor_id = "", category_id = "" }, new { action = @"Create|Edit" } ); But ...

0
голосов
1ответов
672 просмотров

.Net MVC: Bind route value to a session value

I want to do the following: The user should have his own sub site on my web site. Therefor I've added a new route: routes.MapRoute( "ShopEntered", "{username}/{controller}/{action}/{id}", new { controller = "Home", action = "Index", id = "" } ); When the site gets called for the f...

3
голосов
3ответов
844 просмотров

asp.NET: Unknown length MVC paths

I am building a MVC application in asp.NET for a web portal. I have prepared a series of controllers, and mapped all the paths that don't macth to this to a Page controller, which will render the appropriate page. My default route works like this: routes.MapRoute( "Default", "{level1}/{leve...

2
голосов
3ответов
497 просмотров

asp.net mvc url routing

How do I map something like domain.com/username? The problem is I think that the MVC routing looks for the controller to determine how it should handle the mapping request. I am pretty new to ASP.NET MVC. However, based on the tutorials so far, the routing mechanism seems rather rigid.

2
голосов
1ответов
613 просмотров

How do I write a link to a static file in ASP.NET MVC?

In my MVC application I have a folder full of PDF documents users should be able to view. However, my links to them don't seem to work: I get a "resource can't be found error". I'm guessing my problem has something to do with routing. What do I need to do so that the browser just renders the doc...

5
голосов
1ответов
542 просмотров

Routing an hierarchical path from DB with ASP.NET MVC

Is it possible to route an hierarchical path to map a relation from the database as follows: Let's say I have an tuple/entity "page" with an m-t-m relation to a "page" (itself) and I want to be able to combine the slug-value of each page to find an appropriate page, like so: mydomain.com/firstp...

2
голосов
2ответов
334 просмотров

asp.net MVC creating my own routes

hi i am trying to create a URL that looks like this: black/granite/worktops where the black and granite will change so i have tried to create my own routes in global.asax.cs like so: routes.MapRoute("Kitchen", "kitchen/[color]/[surface]/[type]", new {controller = "kitc...

3
голосов
5ответов
2293 просмотров

URL Rewriting with UrlRewriter.Net, ASP.NET MVC Routing or What Do You Recommend?

I'm just wondering, if you are creating a new ASP.NET web forms app in ASP.NET 3.5, which would you recommend for URL rewriting? UrlRewriter.NET or ASP.NET MVC Routing. I've used UrlRewriter.NET before and was pretty happy with it. Opinions anyone?

3
голосов
3ответов
339 просмотров

Routing issue in Asp.Net Mvc

I have a list of puzzles that are tagged with specific "Themes". Think questions on stackoverflow tagged with certain categories. I'm trying to get my route setup so that it works like this: http://www.wikipediamaze.com/puzzles/themed/Movies http://www.wikipediamaze.com/puzzles/themed/Movies,An...

1
голосов
3ответов
131 просмотров

MVC Routing question

I have the following route: routes.MapRoute("Archive", "archive/{year}", new { controller = "Archive", action = "Results" } ); I have the route working correctly, but I would like my url to show as follows: http://mysite.com/archive/2008 when I click on the search bu...

1
голосов
4ответов
548 просмотров

Shortening URL params with MVC routing

I have a url along the lines of this: example.com/profile/publicview?profileKey=5 and I want to shorten it to this with routing example.com/profile/5 How do I do this? This is my attempt: routes.MapRoute( "Profile", "Profile/{profileKey}", new { controller = "Profile", acti...

1
голосов
3ответов
1191 просмотров

ASP.net MVC Areas and creating an ActionLink with ID (SEO / clean URL)

I am building a Help Desk Ticket system for a client using ASP.NET MVC 1.0 / C#. I have implemented Steven Sanderson's "App Areas in ASP.NET MVC, Take 2" and it is working great. In my Globabl.asax page I have some routes defined as such: public static void RegisterRoutes(RouteCollection route...

10
голосов
2ответов
5705 просмотров

Url.RouteUrl returns null

I'm buiding a UrlHelper for a route as in best practices the problem is that the returned value is always null when debugging in found that Url.RouteUrl("x") return null Url.RouteCollection["X"] return Route i'm trying to do : public static string Category(this UrlHelper helper, int Id, string ca...

0
голосов
2ответов
727 просмотров

Problems with a custom route in ASP.NET-MVC

I am having problems with Html.ActionLink when I have a route that takes one parameter. I have the following routers in global.asx: routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", ...

0
голосов
1ответов
51 просмотров

Setting Routes Inside/Near Controller Actions?

About 10 stackoverflow.com podcasts back Jeff mentioned that instead of wiring up his routes inside of the global.asax file he instead put them inside his controllers near the actions those routes would invoke. How does one go about doing this? Doesn't a route have to be registered before the...

5
голосов
3ответов
11491 просмотров

ViewContext.RouteData.Values["action"] is null on server... works fine on local machine

I'm having a weird issue where ViewContext.RouteData.Values["action"] is null on my staging server, but works fine on my dev machine (asp.net development server). The code is simple: public string CheckActiveClass(string actionName) { string text = ""; if (ViewContext.RouteD...

2
голосов
1ответов
550 просмотров

Can I map new routes to the RouteCollection outside Global.asax?

I'd like to occasionally map new routes to the RouteCollection during program execution long after the Global.asax RegisterRoutes() method had first executed. How can I do this?

1
голосов
2ответов
2536 просмотров

ASP.NET MVC - Implicit Form Action

I have a form which is part of a partial view and I need to submit it to a different location based on the context of the view containing the form. I can't use Html.BeginForm because the form has a multipart/form-data enctype so having the action filled in automatically is out the door. Is there...