asp.net-mvc

.NET: DataAnnotation attributes in general

ASP.NET MVC 2 will support validation based on DataAnnotation attributes like this: public class User { [Required] [StringLength(200)] public string Name { get; set; } } How can I check that a current model state is valid using only pure .NET (not using MVC binding, controller methods, etc.)? Ideally, it would be a single...

Share Object to all Users of mvc Webapp.

My web App prepares out of a db for one or two minutes a specific and read-only object list, once only when IIS starts. This does not change any more unless the admin triggers recreation by a specific URL. The Interface of the objects looks like this: public interface IProductsRepository { IQueryable<Row1> ProductItmes { get; } ...

Install a Asp.Net MVC application as a non default website under IIS 6.0

How can i install a Asp.Net MVC application as a non-default website under IIS 6.0. I want the users to specify the path for drive for web app. They install in any drive and create a virtual directory pointing to that drive. Can these be done in Set up project i have for the web app. How can in configure this? ...

MVC default model binding to complex list

Hi, I'm having some trouble binding to a nested list with the default binder. I am using linq to sql and have the following data structure Competition < CompetitionQuestions < CompetitionQuestionChoices my html is as follows <%= Html.Hidden("Competition.Id",Model.Competition.Id) %> <%=Html.TextBox("Competition.CompetitionName", Mod...

How do I implement an interstitial "loading..." page in ASP.NET MVC?

I have a SearchController with an action that can execute some long running searches and return a results page. The searches can take anywhere from 1 to 60 seconds. The URL for a search is an HTTP GET request of the form: http://localhost/Search?my=query&amp;is=fancy The experience I'm looking for is similar to the many travel sites t...

Why is in memory data persisted across multiple browser sessions in my MVC prototype?

I've got a basic MVC application - generated from the MVC application template. I've created a basic controller which contains the usual Index, Details, Edit and Create methods; I've got a couple of classes one to hold my object called Person: public class Person { public int Id { get; set; } public string FirstName { get; set;...

ASP.Net MVC - Trapping certain URL's to do 301 Redirect

I am moving from an old site design to a new design with new URL's. All previous page names were static files called PageXX.html, PageX.html, Index.html - where X is a number. My site is now dynamic but I want to trap for those 3 incoming url's and then try and redirect to a certain new page (301 Redirect) else send them to the home pa...

non-nullable type 'System.DateTime' , ASP.NET MVC

I have a registration page, and because of content issues we have to request and enforce applicants giving a birthdate. So it stands to reason that this field cannot be null. I am using jQuery to watermark the textbox to tell them that they can click it and get a jQuery UI Calendar object to pick the date. Picking the date works fine, t...

GUID Primary Key not being created

When I add a user to my database, I am using a Guid for the primary key. But it is coming in as just a solid string of 0's. Where am I supposed to set it? I set it to "RowGuid()" in the MS-SQL server... ...

Using cookies to store session in ASP MVC

Storing the entire session in a cookie has been standard in Rails for the last few years - is there an easy way to achieve something similar with ASP MVC? By default, anything in Session / TempData is stored in memory on the server. In web.config this can be changed to an SQL Store / server-side cache. I'd like to be able to have these ...

Encoding HTML using Html.ActionLink

Using ASP.NET MVC 2.0, I have an actionlink that is used for comments on a particular post: Html.ActionLink("Comments", "Details", new { id = String.Format("{0}#comments",item.Title) }) What happens however is that the #comments gets encoded to %23comments, which doesn't work. Any ideas on getting around that? I've tried Url.Action ...

Uploadify not firing events outside of localhost

hey everyone, I have a pretty straight forward uploadified page that allows users to upload files, it works beautifully when I run it on my local machine accessing it through http://localhost/project/etc the problem is when i try to access the same stuff from outside of localhost, even if trying to get to it through my machinename (htt...

Properly url encode space character

I use HttpUtility.UrlEncode to encode any value that is used in a route. I already solved an issue with encoding forward slashes. The new problem I have now is with spaces. A space is encoded as + . This works on the VS integrated Webserver, but I have an issue with it in IIS7 on Windows Server 2008. If I have the URL http://localhost...

Add a single page of ASP.Net MVC to an existing Web Forms app?

I've been poking around this site and I've seen a few post about how to "migrate" to MVC from Web Forms... but as a single developer working on a complex Web Forms app I simply don't have the time to to a full migration. What I want to do is add all new content using MVC, and migrate older content over as I have time (and/or have too). ...

How to use a standard webform aspx file inside an MVC project?

I have to write this script to send a mass email reminder but our head dev is out of town so I can't do a patch to the .dll, instead I am using an .aspx page that I can just push out. Problem is I cannot seem to get it to run, I put it into an open directory that allows browse-to-able-ness (avoiding the map routing) but I keep getting th...

There is no ViewData item with the key 'Value' of type 'IEnumerable<SelectListItem>'.

Hi there I have the following code: // GET: /PlayRoundHole/Create public ActionResult Create(int id) { DB db = new DB(); var t = db.Players.ToList(); IList<Player> player = db.Players.ToList(); IEnumerable<SelectListItem> selectList = from c in player select new SelectListItem { Text = c.F...

Can't see the save data with linq?

Hi there I have the following code: // // POST: /PlayRoundHole/Create [AcceptVerbs(HttpVerbs.Post)] public ActionResult Create(FormCollection collection) { try { DB db = new DB(); PlayRound playRound = new PlayRound(); playRound.Pl...

DataContextProvider

Going from the example given here... http://ericswann.org/blog/archive/2009/04/06/linq-to-sql-datacontext-provider-revisited.aspx I'm trying to use the datacontext between the MembershipProvider and the RoleProvider. For instance, when I call Membership.GetUser(XXXXXX) in the RoleProvider, I get an error because it pulls an item from ...

301 Redirection Layer in Microsoft asp.net MVC using phil haacked code doesn't work for me

I need a set up a website that accepts URLs from an older web site version and permenantly redirect them to the new site. I tried this code from Phil Haack's blog but it seems to redirect everything and severely screw up all route generations. http://haacked.com/archive/2008/12/15/redirect-routes-and-other-fun-with-routing-and-lambdas....

how to create themes and skin in asp.net mvc?

Anyone point me to any article that describes how to use themes and skins in an asp.net mvc application? ...