asp.net-mvc

Retrieve static data from database vs. file system

I am about to start a project using ASP.NET MVC. As part of the project, we need to display some data to the user. The data consists of an object graph that consists of 35 days per line. Each day can be a work day or off day. If it is a work day, there could be additional information associated with the work day. So basically, we have an...

ASP.NET MVC Futures RequireSSL Attribute and Authorize Attribute Together

Is anyone successfully using both the Authorize and RequireSSL (from MVC futures) attributes together on a controller? I have created a controller for which I must enforce the rule that the user must be logged in and using a secure connection in order to execute. If the user is not on a secure connection, I want the app to redirect to ...

Using a View Model + Data Model in ASP.NET MVC to support typed views?

How do most developers handle Typed Views in ASP.NET MVC when dealing with large applications? We are considering putting View-specific models in the Models folder, then putting all domain objects into a separate project. This way our Controllers can easily add the domain object to the typed view, without the domain object needing to b...

Model not rendering model values after post.

I have an ASP.NET MVC page that has a list of items... //a vague representation Model.someValue[0] Model.someHiddenValue[0] Model.someValue[1] Model.someHiddenValue[1] Model.someValue[2] Model.someHiddenValue[2] All fields are optional, but they do have some validation, of which I am showing validation messages. The pro...

Posttorial: ASP.NET MVC, Entity Framework and LINQ video tutorials - Including MIX09, PDC, TechED

EDIT: During this post I started searching on video tutorials on ASP.NET MVC, EF and LINQ and found some very useful links which I shared here. As I believe videos are more interactive and easier to learn from. Hope, they'll help. Guys, please share the resources to get start on MVC, Entity Framework and LINQ. And if you...

Posting a form and redirecting to action ASP.NET MVC

I have a navigation bar that uses JQuery to move between 4 stages of signup process. However I need to make sure everything is working with JS disabled. So I have these 4 link images at the bottom of the page and I need so that if one is clicked it posts to the current action so I can save all the form data and then redirect to the nex...

Where should I place Recaptcha.dll in my asp.net mvc application?

So, I've implemented ReCaptcha in my ASP.NET MVC application via these instructions: http://devlicio.us/blogs/derik_whittaker/archive/2008/12/02/using-recaptcha-with-asp-net-mvc.aspx My question is, after I've created my reference to my dll, where should I place the DLL in my solution? Should I just make a references folder or ... ? ...

How do you handle multi-part forms in ASP.NET MVC?

I want to make a sign-up form that spans across 3 pages in ASP.NET MVC. What method should one use to persist the users answers for the first and second pages before submitting the 3rd page? Is it done with TempData, Session, or some other method particular to MVC? Are there any examples of how to do this? ...

HttpContext.Items with ASP.NET MVC

I'm implimenting my own ApplicationContext class that uses the singleton pattern. I want to store my instance of it in HttpContext.Items, since it is accessible in all parts of the request. I've been reading about using HttpContext with ASP.NET MVC and one of the major pains is that it introduces testing complexity. I've tried doing re...

AOP and Applying Security to UI Elements

I'm working on an application in which we are trying hard to keep Separation of Concerns as strongly as possible. We're finding that the cross-cutting concern of security creates a number of complications. However, it looks like these can be mitigated using attributes and Aspect-Oriented Programming. I understand it as far as applying ...

In a View, What is the most efficient way to hide HTML related to a null value from the Model?

This is likely a very simple question with a straightforward answer but I'm something of a newbie when it comes to ASP.NET (MVC). I am returning an address (in pieces) from my model. Some of components are null. Is there a simple or fluent-like way to check for that null value without a lot of extra code to determine whether or not to...

Validation on ViewModels in ASP.NET MVC

Most of the tips on how to implement validation in ASP.NET MVC seem to center around the Model (either building service layers between model and controller or decorating properties of the model with validation attributes). In my application I use ViewModels for all communication between the controllers and the views. I have a ViewMode...

ASP.NET MVC: OutputCache and http headers

Hi guys I have just started using OutputCache on some of my controller actions and I am not quite getting the response I would expect. I have set the cache time to 5 minutes and the Expires header is coming up the same as the Last-Modified header which is the time that the request was made. This is the header I am currently getting: ...

What coding conventions that help jQuery and Firebug work together?

I'm fairly new to both tools and need to go hardcore with both as I manage, monitor, and tweak a new site's design process. What sort of strategies should I ask be implemented that sets a good solid foundation for debugging, testing, and logging? [to the degree that back-end stuff can play a role - it's .net mvc thx ...

F# and ASP.NET

Hi, is it possible to write ASP.NET (MVC) applications with F# code? If yes, how? What possible benefits would this provide? Thanks. ...

Unit testing custom action filter

I have created a custom action filter (attribute) that hits a database. How can I unit test the controller actions by injecting a mock repository (so that it doesn't actually hit the database for the unit test) for the action filter to use? ...

Ambiguous Action Methods - ASP.net MVC

Hi I am having trouble doing something that is probably pretty simple! I have a stock listing that is done by 1) a simple form with parameters (\Index) and 2) an ajax called partial view that displays the list of stock (based on the params). On this same simple form (\Index) I have an action link to an "Add Stock" method which calls a...

Asp.net mvc grid with each cell having its own record

I am wondering about the most elegant solution of having a grid with each cell having its own record and specify say 3 records across 5 down for example. It is having a "tile" effect of records ...

CSS not updated during debugging ASP.NET MVC application

I am working on a test application based on ASP.NET MVC. I am new to CSS stuff so I am learning that as well. I have created a master page called "new.master" and created a new css "new.css". I am calling the view from controller as: return View ("About", "new"); What I am doing is that I am frequently updating the css and master pag...

AJAX behaving differently for Submit button vs. this.form.submit?

I'm trying to auto-save a selection in a dropdown (ASP.NET, MVC, VB), but it's not behaving as expected. Here's the dummy action in the controller: <AcceptVerbs(HttpVerbs.Post)> _ Function TestAction(ByVal id As Integer) As ActionResult Return Content(id) End Function and the HTML: <script type="text/javascript" src='<%= Url.Cont...