asp.net-mvc

How can I implement Caching Strategy in my Asp.net Mvc With linq2sql repository?

I dont know if I should use the httpcontext caching or the Enterprise Library Caching Application Block. Also, what is the best pattern for the caching Strategy when deleting or updating an entity that is part of a cached list? Should I remove all of a list from the cache or only remove the item from the cached list? If I update it will...

Is asp.net webforms swept under the rug to make room for mvc?

I've read all the marketing speak about how mvc and webforms are complementary etc... However it seems that all the blogs talk about is mvc and the only news coming out is about mvc. Is microsoft going to continue to IMPROVE webforms as a first class citizen or will it just be a supported technology as they move all their real efforts,...

Unit Test the Routes

Let's say I have defined a route: routes.Add(new Route("Users/{id}", new MvcRouteHandler()) { Defaults = new RouteValueDictionary(new { controller ="UserInfo", action = "UserInformation", id = ""}), }); So, how am I going to create a unit test to ensure that when Users/12...

HTML.ActionLink method

Let's say I have a class public class ItemController:Controller { public ActionResult Login(int id) { return View("Hi", id); } } On a page that is not located at the Item folder, where ItemController resides, I want to create a link to the Login method. So which HTML.ActionLink method I should use a...

Why is it removed: ASP.NET MVC CheckBoxList (w/o MVCContrib)

Why is the CheckBoxList removed from asp.net MVC preview release 5? Currently i don't see any way in which i can create a list of checkboxes (with similar names but different id's) so people can select 0-1-more options from the list. There is an CheckBoxList list present in the MVCContrib library but it is deprecated. I can understand t...

Mixing jQuery and YUI together in an app, is it easily possible?

I have to preface this with the fact that I love jQuery as a JavaScript language extension and YUI as a rich set of free controls. So here is my question, is there going to be any problems down the line if I mix jQuery and YUI together in an MVC app I am working on. I want to use jQuery for the heavy lifting on the DOM and I want to us...

ASP.NET MVC Preview 5 on Mono

Does anyone have any information about getting the current versions of ASP.NET MVC (Preview 5) working on Mono 2.0? There was info on the old versions (Preview 2, maybe Preview 3), but I've seen no details about making Preview 5 actually work. The Mono Project Roadmap indicates ASP.NET 3.5 for Mono 2.4 (next year). Any ideas on how to g...

How can I intercept the HTML from a ViewResult, modify it and serve it up?

I'm writing a simple CMS. I want to be able to load a View, having it included inside a master page, and then scan the HTML so that I can replace some custom tags (like {{blog}} with my own blog output) and then serve it up to the browser. How can I get access to the HTML from the ViewResult in order to intercept it? ...

Url as parameter gets intercepted

In my asp.net mvc app I want to check if a certain url returns a valid response. Therefor I send the url to a method that tests the HttpWebRequest.GetResponse() On my dev server (vs2008) it works just fine. When deployed on production server however, it returns a Bad Request. The method is never hit and my asp.net custom error pages are...

Master page from external library

I want to put my master pages in a central library so I can use them in several projects without having the maintanance nightmare. Everything is refactored in a generic and central way, they are all in a "shared" namespace. But if put them in a seperate project, I can't reference them ...

How do you use querystrings with ASP.NET routing?

The new ASP.NET routing is great for simple path style URL's but if you want to use a url such as: http://example.com/items/search.xhtml?term=Text+to+find&page=2 Do you have to use a catch all parameter with a validation? ...

How to format JSON Date?

I'm taking my first crack at AJAX with jQuery. I'm getting my data onto my page, but I'm having some trouble with the JSON that is returned for Date data types. Basically, I'm getting a string back that looks like this: /Date(1224043200000)/ From a total newbie at JSON - How do I format this to a short date format? Should this be hand...

Setting the Body's OnLoad attribute in an Asp.net MVC Master Page

I have a view using a master page that contains some javascript that needs to be executed using the OnLoad of the Body. What is the best way to set the OnLoad on my MasterPage only for certain views? On idea I tried was to pass the name of the javascript function as ViewData. But I dont really want my Controllers to have to know about t...

How to get the Silverlight XAP copied to the clientbin on build

I am just getting started with Silverlight and have recently added a Silverlight project to an established solution. In this particular scenario my solution included an existing ASP.NET web site (not application) which Visual Studio kindly offered to integrated my Silverlight application into, which I accepted. So everything is fine and...

Render partial from different folder (not shared)

How can I have a view render a partial (user control) from a different folder? With preview 3 I used to call RenderUserControl with the complete path, but whith upgrading to preview 5 this is not possible anymore. Instead we got the RenderPartial method, but it's not offering me the functionality I'm looking for. ...

Issues During ASP.NET MVC Upgrade from Preview 5 to Beta?

What issues or refactoring did you have to do when you upgraded from ASP.NET MVC Preview 5 to the newly released Beta version? ...

Image equivalent of ActionLink in ASP.NET MVC

In ASP.NET MVC is there an equivalent of the Html.ActionLink helper for Img tags? I have a controller action that outputs a dynamically generated JPEG and I wanted to use the same Lambda expressions to link to it as I do HREFs using ActionLink. Alternatively, a helper that just gives the URL to a route (again specified using Lambdas) ...

How do you retrieve the directory of an ASP.NET MVC application?

Newbie question... If I have a file that is in the root of the web app. How do I programmaticaly query the path of that file? ie, what directory it is in? ...

ASP.NET MVC Beta 1 - where is Html.RenderPartial?

I'm just in the process of upgrading my Preview 5 application to Beta 1, and I'm nearly there save for this one error when trying to render a control: 'System.Web.Mvc.HtmlHelper' does not contain a definition for 'RenderPartial' and no extension method 'RenderPartial' accepting a first argument of type 'System.Web.Mvc.HtmlH...

Best way to gradually convert an existing ASP.NET site to MVC

Please keep in mind that this is new for me and I might have missed something important. I have an existing website, based on an ASP.NET web application. I am now using ASP.NET MVC for new development, and intend to gradually replace the bulk of the pages with MVC based pages. I have two issues here: 1) I need to replace the pages gr...