Urls for menus in my ASP.NET MVC apps are generated from controller/actions. So, they call
controller.Url.Action(action, controller)
Now, how do I make this work in unit tests?
I use MVCContrib successfully with
var controller = new TestControllerBuilder().CreateController<OrdersController>();
but whatever I try to do with it I ge...
When a request is 404 in ASP.NET on IIS 7 i want a custom error page to be displayed. The URL in the address bar should not change, so no redirect. How can i do this?
...
Hi all,
I'm stuck, who can help me out? In my LogOn.aspx View I've login controls (Username, Password, RememberMe) inside a FORM tag:
<form id="loginform" method="post" action="/Account/LogOn/">
Below that, I've a hidden DIV with a OPTION dropdownlist and a confirm-button, with a onclick_event:
$.ajaxSetup({ cache: false });
$.ajax(...
Hallo,
my team and I are about to start a project, and we would really like to use ASP.NET MVC, not the Web Forms. Why? Nothing special, just we want to learn it well and to measure what would be better to use in future projects.
But, our project has important request. We need ability to dynamically load user controls, that can be creat...
Can you point me to some tutorial or samples on how I can log all un-handled exceptions that are occurring on my mvc web app using log4net. Thank you
...
Hello,
I'm still yet to find a decent solution to my scenario. Basically I have an ASP.NET MVC website which has a fair bit of database access to make the views (2-3 queries per view) and I would like to take advantage of caching to improve performance.
The problem is that the views contain data that can change irregularly, like it mig...
When any URL is 404 on my site, i want to show a custom 404 page that is rendered with ASP.NET-MVC. Hoewever i do not want to use the wildcard route approach because that would disable standard webforms. My code currently looks like this:
if (serverException is HttpException && ((HttpException)serverException).GetHttpCode() == 404)
{
/...
Ok, I've just started learning ASP.NET MVC after being an ASP.NET developer for awhile. I think my main problem I'm having is trying to "unlearn" ASP.NET when developing my MVC projects.
Here's my question: I have a page which has some input fields. These fields are parameters to a search I'm trying to run against a database. The us...
Imagine a scenario where I have a sub-form on a page. This sub form is contained in a partial user control and posts to its own dedicated controller action. In the event that a business rule is violated, I want to return the same view the user was previously on.
Example:
User is at /example/page1 which renders partial "SignOnForm"
Si...
There are a number of frameworks out there for building ASP.NET MVC applications (e.g. sharp architecture, etc...)? In defining what a framework is, I'm thinking along the line of Ruby on Rails ... a stack of technologies that enable you to build all tiers of your application quickly, efficiently and with both testability and quality in...
I would like to create in my master page a control that depending on the rendered viewpage will change a css file
I was thinking to make a specific controller "CssController" and call this CssController from the src attribute of the css link. This controller will be in charge of choosing the right css and sending it back with text/css h...
I'm using xVal in my ASP.NET MVC application, which is great in general. Following Steve Sanderson's blog post, I created a DataAnnotationsValidationRunner to do server-side validation of attributed objects. This works great for a simple class. e.g. Person:
public static class DataAnnotationsValidationRunner
{
public static IEnume...
Hello,
I'm writing a web application using ASP.net MVC, NPgsql and NHibernate with PostgreSQL as the database (using VB... not my choice).
One of the tables has two columns with an inet type. In the mapping file, I tried mapping it as a string. This actually worked fine until I had to update a row.
I get an error message: "column "myc...
Hi,
I'm currently working on an Asp.net MVC Web application.
In my solution, there're two projects: front office and back office.
I'd like to share a folder that'll contain resources such as images, documents, etc... that'll be uploaded through the web application.
For example, when I upload an image using the back office, I only need ...
Hi,
I have the following action in my controller:
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Edit(int id, FormCollection formCollection)
{
// do stuff with form collection
}
this works fine. my problem is that when i use a view model object (say MyFormViewModel) no properties contain any form details. e...
The URL for the administration section of my website always starts with Admin/. Is it possible in ASP.NET MVC to restrict access to users by using this part of the URL?
Obviously I would keep the [Authorize(Roles = "Administrator")] on appropriate controllers and actions but I wonder if it would be quicker for the application if it can ...
Using S#arp Architecture 1.0RC...
I have a controller that never seems to update one of my properties.
My class is a User abstract class with a Manager property. Manager is subclasses from User, as is Employee.
I declared the property setter for Manager as protected and provided a method to AddManager. That way, I could also control t...
I have an asp.net MVC website. One of the pages allows the user to dynamically add drop down lists to the page, i.e. the user enters 5, this posts back to the server, where in the view I create 5 drop down lists.
What I then want to be able todo is on every post back send all the values of the drop down lists back to the controller, ma...
Can you suggest me how I can do async operations with asp.net MVC
...
Setup: ASP .NET MVC 1
The Problem:
When ASP .NET hits the RenderPartial("Openings"...) line, an exception is thrown ("Could not load type 'System.Web.Mvc.ViewUserControl(of IEnumerable(of OpenSpace))'.") even though the view exists and the proper model is being passed in. The views are all inside the View folder and in this case, they'...