I 'm really having a hard time with the RESTful paradigm + nested urls. I have asked a question that lead me to where I am right now here. My Domain is roughly this: there are schools, courses of a school and teachers of schools. Now schools, courses and teacher are not "nested" entities in the sense that you can refer to any of them wit...
Hi there,
Can anyone tell me how i can manually edit my naming convention of my routes.. Let me explain. I am programming everything in english as per microsoft standards but i require
www.mydomain.com/Reserva (Spanish for reservation)
I actually have the following
ReservationController and then below views i have a folder called...
I have a separate utility class that is called in the controller, and i need to access a file inside the Views folder. Inside the the Views{controller} are a couple of sub folders that contain the different views. What I'm looking for is something similar to using:
HttpContext.Current.Request.PhysicalApplicationPath
to get the physic...
My problem is pretty simple. I've got a Uri and I want to figure out which route it maps to so I can do some checks on the various pieces of the route: controller, action, etc.
How do I go from Uri to RouteData or Route?
...
I have an action in which I want to intercept any possible integer id that comes and place it behind a hash. (I have some Javascript that is handling the id). I am only doing this extra step for the sake of URL-hackers like me who might forget my convention of putting a hash before the id.
Here is my action:
public ActionResult Edit(in...
I'm writing a new asp.net mvc application and I've been toying with the idea of allowing my user to post short, concise urls to content that he has posted. Those short url's will be handy in cramped spaces like Twitter and comment areas. I like this idea as I'm not a huge fan of url shorteners because they're so vague and you're never re...
Is there any way to change the url after an ajax call. I have a page (eg., url - xyz.com/employees) which displays all the employees, and there is a link on the page named 'Add Employee' which returns a partial view. As this being an ajax call, the url remains the same, is there anyway to change the url to xyz.com/addemployee after retur...
I've been getting two exceptions at random times in my asp.net mvc code running on iis7:
Exception type: InvalidOperationException
Exception message: Collection was modified; enumeration operation may not execute.
at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
at System.Collections.Generic.List...
A call to localhost ( using the VS 2008 integrated webserver ) is not working ( empty page.. )
http://localhost:6666
but a call to a remote IIS
http://asdf.com/MyApp
is routed to the correct controler and method (SearchController -> Search )... MyApp is the IIS directory in which the folder "Controller" is...
The routingcode:
...
MVC encourages RESTful URL's, yet HTML forms by nature append the data in query string values. My action takes "text" as a string parameter. And my form is:
<% using(Html.BeginForm("Action", "Controller")) { %>
<%= Html.TextBox("text") %>
<input type="submit" value="submit" />
<% } %>
My action is:
public ActionResult Action(stri...
I'm not really sure how to express this, but one pattern I often see in RoR apps is something like this:
/Post/postid/Comment/commentid
or
/Project/projectid/Tasks/taskid
Essentially in the model since a Project has Tasks you can access the TaskController from within a project resource.
Now I have started using the SimplyRestfulRout...
If I have a route:
routes.MapRoute(
"RouteName", // route name
"{action}", // url with parameters
new { controller = "Home", action = "Index", id = "" } // parameter defaults
);
I want to be able to catch URL's of the form:
http://site...
We're looking at the ASP.NET MVC 2 beta RenderAction() method. We like it very much but it seems that we can't use async controllers with it. Does anyone have an example of a "controller" that can figure out all the actions that will be called, cache the data, then let the called actions know that their data already exists vs. having ...
Hi All,
I have a catch-all route setup in ASP.NET MVC, so I can capture /this-page, /that-page etc.
When you hit a page the action is invoked, say Index(string page) and then page is tested against a value in the database to determine if the page can be found. If it can't be found, I want to display the view FileNotFound which is in ...
how would i go about finding out what action was defined for this function
protected override void ProcessRequest(HttpContextBase httpContext)
{
IController Controller = new CatalogController();
(Controller as Controller).ActionInvoker = new MyActionInvoker();
Controller.Execute(RequestContext);
}
a...
I'm using mvc 2 release candidate, and am wondering if there's any way to pass a model to an action using RedirectToAction.
For example, I have an edit action which takes an ID, and loads the record from a database, displays the current values in text boxes and lets the user edit and click submit:
public ActionResult Edit(int ID)
The...
I have a controller with the following actions:
public ActionResult Create()
{
return View(new MyModel());
}
[HttpPost]
public ActionResult Create(MyModel model)
{
//Update database
...
//Pass the current model so we don't have to load it from the database
return View("Details", model);
}
[HttpPost]
public ActionRe...
I'm building an APS.net MVC 2 app, where I have a parent table and a child table.
I've got the controller, view and model built for the parent table, so I can Add, Edit, View Details and dete records from the parent table.
I using the following routing to do this:
routes.MapRoute(
"Default", ...
I've created a routing structure whereas the action part of the URL serves as a dynamic handler for picking a specific user created system name. i.e.
http://mysite.com/Systems/%5BSystemName%5D/Configure, where [SystemName] designates the name of the system they would like to configure.
The method that routes the system is the following...
Please excuse the confusing title ;)
We've built an ASP.NET MVC application to replace our "old" ASP.NET webforms monster. We still want to support some of the old URLs used there, because these may still float around in E-Mails etc. somewhere out there.
For example: Our old system used the URL ~/Password.aspx, the URL in the new MVC s...