asp.net-mvc

ASP.NET MVC Routes with "File Extensions"

I want to make an MVC route for a list of news, which can be served in several formats. news -> (X)HTML news.rss -> RSS news.atom -> ATOM Is it possible to do this (the more general "optional extension" situation crops up in several places in my planned design) with one route? Or do I need to make two routes like this: routes.MapRou...

StructureMap IOC/DI and object creation

I'm building small web shop with asp.net mvc and Structuremap ioc/di. My Basket class uses session object for persistence, and I want use SM to create my basket object through IBasket interface. My basket implementation need HttpSessionStateBase (session state wrapper from mvc) in constructor, which is available inside Controller/Action....

StructureMap error when invalid controller

I am using Structure map like the MVC storefront by Rob Conery does and I have an AdminController and so to get to it I just type: website/Admin/action however if I miss spell the controller name I get the error below: Exception Details: System.ArgumentNullException: Value cannot be null. Parameter name: key There error occurs on th...

Problem with Windsor Castle with IIS7

Hi All, I am using windsor DI framework in one of my MVC project. The project works fine when I tried to run from Visual Studio 2008. But when i tried to run the project creating an application in IIS7 then I recieved the following error message: Looks like you forgot to register the http module Castle.MicroKernel.Lifestyle.PerWebReq...

Better way to implement an Html Helper method?

I created an html helper Html.BreadCrumb(IDictionary<string, string> crumbs) Where the first string is the label and the second string is the URL. The helper creates the html required (an unordered list, some classes for first element, current element, last element, dead element and separators etc) All working nice, but I do this by ...

ASP.NET MVC Config Question

What exactly is this line in the config doing when it is using IIS7 Integrated mode? <add name="UrlRoutingHandler" preCondition="integratedMode" verb="*" path="UrlRouting.axd" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> Without this I get an err...

What is a CAPTCHA that is compatible with ASP.NET MVC ?

What is a CAPTCHA system that is compatible with ASP.NET MVC ? Are there any good examples out there? Thanks. ...

What is the best method to keep bots from spamming your blog?

Hey all! I got a problem at my blog. I got visits from kind bots who leave "nice" comments to my blog posts :( I'm wondering if there is a smarter way to keep them out, besides using the captcha modules. My problem with the captcha modules is that I thinks they are anoying to the user :( I don't know if it's any help to anyone but m...

How to use varnish/squid with IIS/ASP.NET website?

I am working on a website with lots of images (think smugmug/flickr) and from what I read, flickr is using squid as the image cache. My images will be stored on Amazon S3, so a caching server will help saving the hosting money as well. I'd like to hear ideas on it is do-able with the following configuration. My ASP.NET/MVC application...

Get full request url, including parameters in controller

How do I get the complete request URL (including query string) in my controller? Is it a matter of concatenating my URL and form parameters or is there a better way. I checked this question, but it seems not to be applicable to MVC. Correct me if I'm wrong. --Edit (extended problem description)-- My call to my SearchController.Advan...

Fastest way to insert replacement characters in Visual Studio

I'm just starting to pick up ASP.Net MVC and find myself writing a lot of <%= %> in the views. Intellisense does supply the closing %>, but I find that typing the introductory <%= to be burdensome (they are tough for me to type :-)). I've dabbled around a bit with Rails and the NetBeans IDE where I was able to type: r<tab> - which wo...

Save state for DropDownList after post

Hi, i have form with one textbox and dropdownlist <%=Html.TextBox("Name")%> <%=Html.ValidationMessage("Name", "Enter name")%> <%=Html.DropDownList("Not Selected", "DomainID", ViewData["DomainID"])%> I select value from drop downlist but dont fill name, im getting validation for textbox and then i need select value from dropdown agai...

asp.net mvc radio button state

I'm trying out asp.net mvc for a new project, and I ran across something odd. When I use the MVC UI helpers for textboxes, the values get persisted between calls. But, when I use a series of radio buttons, the checked state doesn't get persisted. Here's an example from my view. <li> <%=Html.RadioButton("providerType","1")%><l...

How to get current user in Asp.Net MVC

In forms model, I used to get current logged in user by Page.CurrentUser How do I get current user inside a controller class in ASP.NET MVC? ...

MVC XHTML Compliance Question

I have a model being populated by my data layer and then I have a partial view which is rendering an instance of that model. <li class="<%= td.Active ? "youarehere" : string.Empty %> <%= i == ViewData.Model.Count() - 1 ? "last" : string.Empty %>"> The problem is that class="" is invalid XHTML and I will need more complex logic to outp...

Number/Date Conversion helpers in MVC, where to use them?

Stackoverflow is built on MVC and does a bunch of simple but nice things with dates and numbers (answer counts, votes, etc...). I'm assuming this is all done with a couple of static helper classes. My question is should the view call these helper objects or should the controller call these helper objects and embed the result into the V...

How to use ASP.NET MVC ActionFilterAttribute/IResultFilter to modify output

I am trying to modify the output stream to search/replace some XHTML tags returned from a View. I could use an traditional ASP.NET response filter, but thought to try the ASP.NET MVC action filter first. public class MyResultFilter : ActionFilterAttribute { public override void OnResultExecuting(ResultExecutingContext filterContext...

$.getJSON returning cached data in IE8

Hey all, I'm playing around with ASP.net MVC and JQuery at the moment. I've come across behavour which doesn't seem to make sense. I'm calling JQuery's $.getJSON function to populate some div's. The event is triggered on the $(document).ready event. This works perfectly. There is a small AJAX.BeginForm which adds another value to ...

Local copy of ASP.NET MVC beta quickstarts?

I just downloaded the ASP.NET MVC beta and wanted to walk through the quickstarts locally. It didn't look like they were installed with the beta installer, and I didn't see an independent download link for them. Is there a place I can find these to save and use locally? ...

How can I get Javascript debugging to work with my ASP.NET MVC application?

I can't seem to get Javascript debugging working for my ASP.NET MVC application even though I can for a traditional ASP.NET WebForm app. I have followed the steps for unchecking the 'Disable Script Debugging' boxes for both IE and other. when I add a simple function to display an alert in both the site.master and any content view the b...