asp.net-mvc

Deploying an ASP.net application

What is the correct proceedure when deploying an ASP.net MVC application? I am using the built in forms based authentication and deploying using the publish function in VS2008 but when deploying it doesn't seem to deploy the ASPNETDB to the server and I end up with errors like An error occurred during the execution of the SQL file 'Ins...

ASP.NET MVC and two Web.config files

Where is the Web.config supposed to go in an ASP.NET MVC project? I just ran into an error trying to do this: _cnstr = System.Configuration.ConfigurationManager.ConnectionStrings["production"].ConnectionString; The default MVC template puts the Web.config at the root of the project. If you go into the properties of a project (...

ASP.NET MVC Namespace renaming

I renamed my project from MyProjectName to MyNewProjectName. I did a complete find/replace on the solution and changed the test project aswell. In Default.aspx.cs I get an InvalidOpterationException with "The controller name 'Home' is ambiguous between the following types: MyNewProjectName.Controllers.HomeController MyProjectName.Con...

Why are there designer files (*.designer.cs) in ASP.NET MVC?

What's the point of the auto-generated 'designer' files in ASP.NET MVC Web Apps? I'm trying out ASP.NET MVC (coming from ASP.NET Webforms projects), so I'm used to just having the one code file with each ASP.NET markup file (.aspx, .ascx etc.). Can I use the code beside model with MVC Apps instead as less files seems simpler? Thanks. ...

Does ASP.NET MVC work under IIS 5?

I have to use XP as my development machine so far. But VS 2008's development server does not seem to work, very strange! (VS 2005's working well). Could I use IIS 5.1 to run ASP.NET MVC? Thanks! ...

How to order by time and time only in C#??

Hi everyone!! I have this recorded in SQL Server: 1- startTime (datetime): 5/2/2009 08:30 (brazilian time format: d/m/y) 2- startTime (datetime): 4/2/2009 14:30 (brazilian time format: d/m/y) My application just records time... the date it's SQL that generates by itself be getting the date of today. When I ask VS 2008 to orde...

What do you test with your unit tests?

TDD is something that seems to be on everybody's lips these days, and I have tried some on my own but I don't think I'm getting the idea. I am getting a grip on how to write a unit test, but I don't understand exactly what my unit tests should test. If I have an action method that returns a list of data, what should I verify? Only that...

What is the best way to handle repeating forms in MVC?

The best public example that I can think of off the top of my head would be the amazon shopping cart. Where you have a page that displays multiple distinct records that can have multiple distinct fields updated. I can't put each one in a form tag because the user may modify more than one record and then submit. I can't just update all ...

Thunderdome MVC- Why one-model-in in MVC?

When Jeremy & Chad posted about their FubuMvc project, one of the differentiators they mentioned was their "Thunderdome Principal": The “Thunderdome Principle” – All Controller methods take in one ViewModel object (or zero objects in some cases) and return a single ViewModel object (one object enters, one object leaves). T...

How do I control repeated Ajax 'post' submissions?

I do not want to stop the user from clicking the same ajax button many times, but I want to exercise some control to prevent someone from maliciously clicking the button repeatedly which would cause repeated database requests. What is simple way to handle this on a jquery .post in asp.net mvc? If I put in a time delay, the experience cli...

How to get model data from a ViewResult in ASP.NET MVC RC1?

Given the following controller class: public class ProjectController : Controller { public ActionResult List() { return View(new List<string>()); } } How can I get a reference to the model object in the following unit test? public class ProjectControllerTests { private readonly ProjectController controller; ...

Multiple route parameters with clean URLs

I'm working a digg clone in ASP.NET MVC to help better teach myself ASP.NET MVC. I've been looking at how StackOverflow handles routing when passing in things like sorts and I guess I thought the whole point of using clean URLs is so you don't have things like ?sort=blah at the end of your URL for SEO. Is there a recommended way of inc...

Maintaing state in ASP.NET MVC when you're not using the UI helpers

I have a bunch of forms where its easier to type the entire html tags: However, when I pass the Model to the View, it doesn't show the value. What am I missing here? ...

Having issues with MVC Routing

I'm trying to implement routing such as the following: posts/535434/This-is-a-post-title posts/tagged/tags+here // Matches {controller}/{action}/{id} - Default // Displays all posts with the specified tags // uses PostsController : ActionTagged(string tags) posts?pageSize=50&pageIndex=4 // Matches {controller}/{action}/{id} - Default ...

How to Integrate ASP.Net Webforms website with an ASP.Net MVC web application?

How would I run both of them under one main website, say www.example.com, which is written and deployed using a Visual Studio ASP.Net MVC web application project, and where an ASP.Net Web Forms website, would run from a subdirectory of the main site, say www.example.com/myapp? ...

Which Method of Model Binding Has Best Unit Test Semantics in ASP.NET MVC?

Definitions In ASP.NET MVC, there are two ways to do model binding in an action. Let's call these the "Bind arguments way" and the "UpdateModel way." Both of them do almost exactly the same thing, and they do it in almost exactly the same way: public ActionResult UpdateWithBindArguments(Foo model) { Repository.Update(mo...

Send asp.net mvc action result inside email

I'd like to use my Action in asp.net mvc, as template engine, that results in form of string, that I could send in email. Pseudo-Code: public ActionResult Register() { SendEmail(View().ToString()); return new EmptyResult(); } ...

Checkbox Array in MVC Framework

Ok not sure what is going on with these checkboxes in the MVC Framework RC1 but here is what I got. I am creating checkboxes using a foreach loop on the view but when I try to access them using the Request.Form.Keys in the controller I get nothing back. My question is how is Request.Form.Keys populated? I know the checkbox inputs are on ...

How can I unit test HandleUnknownAction() of an ASP.NET MVC Controller?

I have the following HandleUnknownAction set on my base controller class: protected override void HandleUnknownAction(string action) { Response.Redirect("/"); } How can I unit test that? Another point, is that way to handle the unknown action correct? Seems that calling RedirectToAction() would be more correct but the HandleUnknow...

From WebForms to ASP.NET MVC

This question is for anyone who has significant experience using ASP.NET WebForms who has made the switch to ASP.NET MVC. What was your business justification for making the switch? Do you consider the MVC platform to be mature? How long did it take for you to be productive using MVC (say 80% of your previous WebForms productivity leve...