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}", // URL with parameters
...
Hey Stackers!
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 routes)
{
// Routing config ...
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", action = "PublicView", profileKey ="" }
);
B...
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 button instead of just:
http://mysite.com/a...
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,Another-Theme,And-Yet-Another-One
My routes...
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?
...
Hi,
is it possible to route an hiearchical path to map an relation from the database as follows:
Lets say I have an tuple/entity "page" with an m-t-m relation to a "page" (it selfe) and I want to be able to combine the slug-value of each page to find an appropriate page, like so:
mydomain.com/firstpage/secondpage/thirdpage
where first...
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 documents?
...
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.
...
I am having a similar problem as described here: stackoverflow.com/questions/364637/asp-net-mvc-on-godaddy-not-working-not-primary-domain-deployment
I have multiple domains pointing to different folders. Each folder is set as an application root in IIS7 on GoDaddy's shared hosting. These folders are [ContentRoot]/websites/folder1, [C...
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 it only works when both vendor_id and cate...
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 how to use it.
//Need to remove "PostInde...
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",
"Products/Search/{searchQuery}/{pageNumber}",
new...
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 URL structure like this:
http://mysite/...
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 than make it its own virtual directory, but I...
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 check if:
destination action and controller ...
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
...
Hi
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/action
The problem appears when the url...
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.countUrgentTickets.Count()
ViewData("HighTixCou...
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? pageSize)
{
// do something magical
}
M...