asp.net-mvc

Asp.Net MVC: How do I get Html.ActionLink to render integer values properly?

Hey all, I have an asp.net mvc application with a route similar to: routes.MapRoute("Blog", "{controller}/{action}/{year}/{month}/{day}/{friendlyName}", new { controller = "Blog", action = "Index", id = "", friendlyName="" }, new { controller = @"[^\.]*", year = @"\d{4}", mo...

ASP.NET MVC Input Validation

I'm currently working on a blog application in asp.net mvc. I can't quite figure out how to handle my input validation! As far as I understand the view itself cannot know about input validation!? So how am I going to do this? ...

ASP.net MVC with Ajax

Does anybody know of an up to date tutorial on using Ajax with ASP.net MVC? Most of what I can find seems to talk about older versions of MVC and I suspect that this is an area where there has been a lot of change of late. ...

Returning form, querystring, cookie values by priority in ASP.NET MVC

I'm wondering why query string is preferred when getting values from user request. Where? 1) Code of System.Web.Mvc.DefaultModelBinder looks like this (only part of it): HttpRequestBase request = controllerContext.HttpContext.Request; if (request != null) { if (request.QueryString != null) { values =...

Best strategy to implement stackoverflow style badges system in asp.net mvc

I was wondering what would be the best strategy to implement a badges system using asp.net mvc. The one that stackoverflow has is pretty interesting. What do you suggest? I guess I need to clarify the question a bit. The problem would be the different criteria for earning every badges. How do make that logic extensible? ...

How can I create this action link?

I'm having issues creating an ActionLink using Preview 5. All the docs I can find describe the older generic version. I'm constructing links on a list of jobs on the page /jobs. Each job has a guid, and I'd like to construct a link to /jobs/details/{guid} so I can show details about the job. My jobs controller has an Index controller...

Unit Testing the Views?

Any idea on how to unit test the views in ASP.NET MVC? I am sick of encountering the yellow screen of death when I launch my MVC project just because I forget to update the views when one of the Action methods of my controller changes name. ...

Asp.Net MVC: How do I get virtual url for the current controller/view?

Is it possible to get the route/virtual url associated with a controller action or on a view? I saw that Preview 4 added LinkBuilder.BuildUrlFromExpression helper, but it's not very useful if you want to use it on the master, since the controller type can be different. Any thoughts are appreciated. ...

ActionUrl in ASP.NET MVC Preview 5

Hi. I don't need a Link but rather only the href= part of the ActionLink. But if I call Html.ActionLink(...) I get a back. Is there a way to just return the URL of the Action while not getting the ? ...

ASP.NET user login best practises

I want to make a login system using ASP.NET (MVC). The last one I did was in PHP and it was 4 years ago. I have looked a bit on the internet, and found some bad examples that involved SQL in Click events. Other information pointed to the ASP.NET built-in membership provider. However, I want to roll my own. I don't want to use the built...

ASP.NET MVC Client Side Validation

I am all about using ASP.NET MVC, but one of the areas that I hope gets improved on is Client-Side Validation. I know the most recent version (Preview 5) has a lot of new features for Validation, but they all seem to be after the page has been posted. I have seen an interesting article by Steve Sanderson... using Live Validation, Castl...

How can you get the "real" HttpContext within an ASP.NET MVC application?

Unfortunately, I need to do this. I'm using ELMAH for my error log. Before I route to my error.aspx view, I have to grab the default ELMAH error log so I can log the exception. You used to be able to use Elmah.ErrorLog.Default However, this is now marked as obsolete. The compiler directs me to use the method Elmah.ErrorLog.GetDe...

Trailing slash on an ASP.NET MVC route

In the latest MVC preview, I'm using this route for a legacy URL: routes.MapRoute( "Legacy-Firefox", // Route name "Firefox-Extension/", // URL with parameters new { controller = "Home", action = "Firefox", id = "" } // Parameter defaults ); The problem is that both of these URL's work: http://mysite.com/Firefox-Extension http://mysit...

CrystalReportViewer Buttons Broken using MVC Framework

We are using the MVC framework (release 5) and the CrystalReportViewer control to show our reports. I cannot get any of the buttons at the top of the report viewer control to work. If I'm working with the report 'HoursSummary'. If I hover over any of the buttons on the report viewer in IE the displayed link at the bottom of the pages ...

ASP.NET MVC - Problem passing parameters to the controller

I have a controller with an action method as follows: public class InventoryController : Controller { public ActionResult ViewStockNext(int firstItem) { // Do some stuff } } And when I run it I get an error stating: The parameters dictionary does not contain a valid value of type 'System.Int32' for parameter 'f...

How do I declare an impicitly typed variable in VB inline in an ASP.Net page?

I want to do the following but in VB: <%=var t = ViewData.Model%> ...

Creating A Private Photo Gallery Using Asp.Net MVC

I need to create a photo gallery service that is managed by users. I've done this a million times using just Asp.net but I was wondering if there are any special considerations that I need to make when using Asp.net MVC. Basically, I will be storing the actual images on the filesystem and storing the locations in a database linking the ...

SSL pages under ASP.NET MVC

How do I go about using HTTPS for some of the pages in my ASP.NET MVC based site? Steve Sanderson has a pretty good tutorial on how to do this in a DRY way on Preview 4 at: http://blog.codeville.net/2008/08/05/adding-httpsssl-support-to-aspnet-mvc-routing/ Is there a better / updated way with Preview 5?, ...

MVC User Controls + ViewData

Hi im new to MVC and I've fished around with no luck on how to build MVC User Controls that have ViewData returned to them. I was hoping someone would post a step by step solution on how to approach this problem. If you could make your solution very detailed that would help out greatly. Sorry for being so discrete with my question, I wo...

Using ASP.NET Dynamic Data site on Windows XP IIS?

I have a Dynamic Data website built in Visual Studio 2008 using .NET 3.5 SP1. The site works OK on my Vista machine, but I get the following error when running it on a Windows XP machine: Server Error in '/FlixManagerWeb' Application. -------------------------------------------------------------------------------- The resource c...