I'm reading Pro ASP.NET MVC Framework book. In an example on 106 - 111 the author walks through creating an NUnit test for a HTMLHelper class.
I noticed that when I ran my HTMLHelper code in NUnit the links appeared like this:
<a href="Page1">1</a>
<a class="selected" href="Page2">2</a>
<a href="Page3">3</a>
But when I see them in t...
Hi,
I'm looking for some advice on storing views in a data-store (database, file, other) and display them based on routing data, all using ASP.NET MVC 2 and ASP.NET Routing.
For example, I'd like to be able to display different views based on the following route data:
/{country}/
/{country}/{area}
But in the same vein I'd like to di...
I have several mvc applications on the same domain, each have their own directory.
mydomain.com/app1
mydomain.com/app2
etc..
When using Url.Content() and Url.Action() when at the root level, 'app1' part is repeated twice in the urls.
// code used to generate the links
<%= Url.Action("tetris", "Apps") %>
Page Url: mydo...
In c# i need to frame the folllowing URL dynamically,here Action is redirectURL and the Controller is Books,when i post the page i send the url to some other page in follwing format.is it posible to frame the URL with "localhost:7187" dynamically?
http://localhost:7187/Books/redirectURL
...
I have a problem in routing on the server (IIS6). It works OK on the development environment:
routes.MapRoute(
"FindCities",
"FindCities/{state_id}",
new { controller = "Regions", action = "FindCitiesByStateID", state_id = "" });
Here I call this action:
$.ajax({
type: "GET",
contentT...
I use a simple ASP.NET MVC web (the template you use when you create a new site) and the web works as expected in my live environment.
I now try to use IIS Application Request Routing version 2. I have a rule that send all reuqests to a different server that match a rule.
The settings are a bit like this: http://blogs.iis.net/wonyoo/ar...
Hi,
I'm having trouble getting a Route working in order to constrain the parameters of an action of a controller to only be integers.
I have a a controller action as follows:
[RequiresRole(RoleToCheckFor = "Administrator"), AcceptVerbs(HttpVerbs.Get)]
public ActionResult Edit(int id)
{
...
}
and the following ...
Hi,
Currently I am using ASP.NET MVC and have home/index for logged out user which appears as "/" but this has got me confused as to how I can have "/" for a logged in user?
I could modify like 127.0.0.1/home - but I want it like "/". My confusion relates to the fact that the "/" [127.0.0.1/] is bound in the routes collection to home/i...
How can I merge this two class to one?
this:
new { action = "index|new|edit" }
new { controller = "category|article" }
To this:
new { action = "index|new|edit", controller = "category|article" }
I know that it's not trivial at all, but here is the problem.
I have a method that I used to register my routes. The method don't have ...
Hi all,
I have a User entity, and in various views, I want to create links to a user home page basically. This fuctionality should be avaialbe in different controllers, so I can easily redirect to the user's home page. Each user in my site has a role ; for example reader, writer, editor, manager and admin. Ideally, I want to try to achi...
I don't think title is making any sense, so I hope that I can explain it well enough.
I have Controler Item with Action EditItem. EditItem is routed to from many places, such as
/Item/Browse/ByCategory
/Item/Browse/ByType
/Item/Browse/ByWhatever
What I'd really like is to return the user to page from where he clicked Edit on an item...
I get a 404 error when I navigate to the following URL using the route below:
http://localhost:53999/properties/
However, all the following are correctly routed to the List action in my controller:
http://localhost:53999/properties/usa/new-york/manhattan/12
http://localhost:53999/properties/usa/new-york/manhattan
http://localhost:53...
I have this sole route in my app:
routes.MapRoute(
"Default",
"{controller}/{action}/{id}",
new { controller = "Home", action = "Index", id = ""}
);
This works great for URLs like:
/Blah/Index
/Blah/Create
/Blah/Details/5
I want to add text to that last one like SO does:
...
Hi!
This should be simple. I want to get an absolute Uri given the controller, action and other routevalues. In other words I want to do what Html.ActionLink does but without the anchor and I want to do it in my controller.
...
What's the difference in ASP.NET MVC of RedirectToRoute and RedirectToAction? It's not clear what the difference is to me.
...
Hiya!
I have setup a custom route as defined in my global.asax:
routes.MapRoute(
"Search", "{controller}/{action}/{type}/{searchterm}",
new { controller = "Search", action = "Results", type = "", searchterm = "" }
);
Now all I want to do it in a controller when data is passed via POST basically go in the form...
I have the following issue, lets say I create an A record with my domain like *.mydomain.com, my main domain has a CNAME record pointing to my Windows Azure given domain name. So it goes as follows:
A record: *.mydomain.com 127.0.0.1
CNAME record: mydomain.com myservice.cloudapp.net
Now I want the ability to control custom subdomain i...
Is it possible to map a route with MapRoute and specify a generic controller e.g
context.MapRoute(
"Dashboard_Edit", // Route name
"dashboard/edit/{*pagePath}",
new { controller = "Dashboard`1", action = "edit", pagePath = "home" }
);
...
I've defined the following route for a simple blog.
routes.MapRoute(
"Blog",
"blog/{year}/{month}/{day}",
new { controller = "Blog", action = "Index" },
new { year = @"\d{4}", month = @"\d{2}", day = @"\d{2}" }
);
The url should be able "hackable" to accomplish the following:
http://abc.com/blog/2010 -> shows all
posts in 2...
First of all, it needs to create some codes that handle any error in my application like the following code.
public class HandleSomeErrorAttribute : HandleErrorAttribute
{
public string ControllerName { get; set; }
public string ActionName { get; set; }
public override void OnException(ExceptionContext filterContext)
{
...