asp.net-mvc

Making sure a view exists

I'm currently looking into unit testing for a new application I have to create. I've got the basic testing going nicely (testing the ActionResult classes is pretty nice). One thing I do want to make sure though, is that a viewpage exists in my solution. I'm not 100% sure my test is correct, so if anyone had suggestions, please don't hesi...

Does System.Web.Mvc.ListItem no longer exist in ASP.NET MVC RC?

Trying to create a list to return some JSON data to a view. Following a few tutorials on the web that were created during the beta but it seems in the RC the code does work. using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; namespace MvcApplication6.Controllers { [HandleErro...

How do I access HtmlHelper methods from within MY OWN HtmlHelper?

I am writing my own HtmlHelper extenstion for ASP.NET MVC: public static string CreateDialogLink (this HtmlHelper htmlHelper, string linkText, string contentPath) { // fix up content path if the user supplied a path beginning with '~' contentPath = Url.Content(conten...

What happened to SetAttemptedValue in ASP.NET MVC RC?

I don't know what to use in place of it? ...

Convert Visual Studio project to ASP.NET MVC

I have a visual studio project which is an ASP.NET MVC project, however it doesn't recognize it as such in Visual Studio so I don't get the nice dropdowns with Add View and such. Rather I just get a very plain add file dialog which doesn't include any MVC file templates. When I create a new MVC project however I get all the nice little V...

Azure Demo Site

I'm planning to give some talks on Azure and ASP.NET MVC. I suspect that the blog site demo has been done to death. What other kinds of relatively simple and approachable (that is, ideas that don't require 10 minutes to describe what the site does) would you like to see used as the basis for a demo of Azure? ...

Sharding with ASP.NET's SqlMembershipProvider?

I'm considering writing a blog hosting app in ASP.NET MVC. I'm new to .NET, but I'm reasonably competent in the LAMP world. My question concerns horizontal scaling of user data. Each user with a blog would have something like 6 tables in a database. I'd like to plan for horizontal scaling so that 20% of the users could be on one data...

ASP.NET MVC RC Form Parameters Problem

Hello all, In ASP.NET MVC Beta I was able to get the form parameters of <input id="addresses[40].City" name="addresses[40].City" type="text" value="City" /> <input id="addresses[40].Country" name="addresses[40].Country" type="text" value="Country" /> as Edit(List<Address> addresses) in controller action. Nonetheless, in the new Rele...

How do I localize the jQuery DatePicker?

I really need a localized dropdown calendar. An English calendar doesn't exactly communicate excellence on a Norwegian website ;-) I have experimented with the jQuery DatePicker, their website says it can be localized, however that doesn't seem to work. I am using ASPNET.MVC, and I really want to stick to one javascript library. In thi...

How do I unit test routes in ASP.NET MVC Beta1

I found articles on how to unit test routes in prior versions of ASP.NET MVC http://www.stephenwalther.com/blog/archive/2008/07/02/asp-net-mvc-tip-13-unit-test-your-custom-routes.aspx http://weblogs.asp.net/scottgu/archive/2007/12/03/asp-net-mvc-framework-part-2-url-routing.aspx but it doesnt work in ASP.NET MVC Beta1. If a mocking fra...

Forcing ActionLinks to be rendered as lowercase

Without creating my own ActionLink HtmlHelper is there a way to force any ActionLinks to be rendered lowercase? Update: Check out the following links for extending the RouteCollection to add LowecaseRoutes http://www.makiwa.com/index.php/2008/05/31/lowercase-mvc-route-urls/ http://goneale.wordpress.com/2008/12/19/lowercase-route-urls-in...

Alternative installers for .NET solutions

I have a solution containing a web application, a windows service plus a few scripts. I'd like it to be possible to click an install file and then choose where to place the files, create a web site or a virtual directory in IIS and install the service. I also have a few script I have to run via an external EXE that will be part of the pa...

BeginForm in RC bug?

I think that there are something wrong with new RC, when i write Html.BeginForm("Item", "Newsletter", FormMethod.Post, new { enctype = "multipart/form-data" }) method must render in output something like this: <form action="/Newsletter/Item" enctype = "multipart/form-data" method="POST"></form> but instead of that im getting: <for...

How do you redirect to the calling page in ASP.NET MVC?

Let's say I have a controller action that deletes an item out of a user's shopping basket. This controller action is triggered by performing a POST to the url ~/delete/{id}. If I have several pages on my application that will post to this url, how do I construct the controller action to redirect back to the page that posted to it? ...

asp.net MVC RC1 RenderPartial ViewDataDictionary

I'm trying to pass a ViewData object from a master page to a view user control using the ViewDataDictionary. The problem is the ViewDataDictionary is not returning any values in the view user control whichever way i try it. The sample code below is using an anonymous object just for demonstration although neither this method or pass...

jQuery Forms Authentication with ASP.NET MVC

Is it possible to use a jQuery ajax call to perform Forms Authentication with ASP.NET MVC? I've been unable to find any such examples. More specifically, how do I set the auth cookie on the page (without a redirect) so I can make successive authenticated ajax requests? ...

MVC invoking default page when opening a different page?

I've got a simple MVC (RC1) app set up, and I'm seeing some odd behavior. The Home/Index page shows a list of items using a ListView. Here's the HomeController code: Function Index() ViewData("results") = From m In context.MyTable Return View() End Function The Home/Index.aspx page just has a ListView on it, and the code behin...

Naming for Conventions for Actions and Views (Revisited)

I'm brand new to MVC and, as a learning exercise, I'm trying to re-write an old application as an ASP.NET MVC application. I'm a little unclear about some conventions which the question Action Naming Conventions only partially covers. Lets say I have two controllers: JobController and ClientController. Both of the controllers are goin...

Html.DropDownList no longer works after upgrade to ASP.NET MVC RC1

I had the following piece of code in a web app running on ASP.NET MVC Beta: <%= Html.DropDownList("Instances", new { style="width:270px;", onchange = "UpdateReport(this)" }) %> where "Instances" is a SelectList stored in ViewData, like so: ViewData["Instances"] = new SelectList(instanceList, "Id", "ClientName", report.SelectedId); ...

How do you test your ASP MVC apps for user based security?

I've been writing tests for my domain objects for some time now, but I'm still not quite sure how to go about testing for security in my web project. Certain users in certain environments can access certain properties of my models etc, but how would you go about testing this? Right now, I'm basing it on the current authenticated user, ...