asp.net-mvc-2

How do I stop an Actionlink redirect and instead popup and redirect using javascript ?

This is script what I have currently - <script type="text/javascript"> $(document).ready(function () { $('.RemoveSystem').click(function () { var href = $(this).attr('href'); var answer = confirm("Are you sure you want to delete this system?"); alert(answer); ...

advice on architecting asp.net mvc applications

I've been using ASP.net MVC for about two years now and I'm still learning the best way to structure an application. I wanted to throw out these ideas that I've gathered and see if they are "acceptable" ways in the community to design MVC applications. Here is my basic layout: DataAccess Project - Contains all repository classes, LIN...

ASP.NET MVC Windows Authentication 403 Forbidden: Access is denied

Hello all, I'm developing an ASP.NET MVC 2 app using Windows Authentication. When I run it within Visual Studio (using the built-in IIS), under the same domain, I was able to login using my credential. But when I deployed it to the server, which is also on the same domain, in-house, I got the "403 - Forbidden: Access is denied." error. ...

Get Areas associated with an MVC project

Is there a way I can get the names of the areas in an MVC project? Here's a few ways I can think of: a) If I had the source, I could browse through the project folder structure and enumerate the folders under the Areas folder. But that wouldn't guarantee all the folders represent areas unless I also enumerated the Controllers and Views...

Entity Framework MVC View Problem

Function Edit(ByVal id As Integer) As ActionResult Dim entities As New Deployment_devEntities() Dim w As System.Data.Objects.ObjectQuery(Of tblWebsites) = entities.CreateQuery(Of tblWebsites)("SELECT VALUE m FROM tblWebsites as m WHERE m.WebsiteID = " & id) Dim q = From m In entities.tblWebsites Where m.We...

ASP.NET MVC 2 validation for variable length or dynamic data views, and view models

OK, so maybe I am really missing something here, but how is it so difficult to do effective server & client side validation in MVC (2)? Here are a few examples: I want to use a variable length list. I follow a great tutorial like Steve Sanderson's variable length list overview. I want to create a custom validator like "RequiredIf". My ...

Allow user to input HTML in asp.net MVC

How can I allow a user to input HTML into a particular field using ASP.net MVC. I have a long form with many fields that get mapped to this complex object in the controller. I would like to make one field (the description) allow HTML which I will preform my own sanitation on at a later point. ...

How to use ASP.Net MVC View inside WebForms .aspx page?

I have a large web application that I have set up as both ASP.Net Web Forms and MVC. Some of the newer pages are MVC (.mvc) and some are Web Forms (.aspx). Since this is a business app and functions are being constantly added, it's hard for me to have the time to stop and replace existing functionality to convert it over. So I would like...

ASP.NET MVC - Unit testing RenderPartialViewToString() with Moq framework?

I'm using this helper method to turn my PartialViewResult into string and returning it as Json - http://www.atlanticbt.com/blog/asp-net-mvc-using-ajax-json-and-partialviews/ My problem is that I'm using Moq to mock the controller, and whenever I run unit test that uses this RenderPartialViewToString() method, I got the "Object reference...

IIS 7.5 Invalid authentication headers 401.2 when viewing site in browser

I have a Visual Studio 2010 project that is using Forms Authentiation. It runs fine from within Cassini (visual studio systray IIS, aka pressing F5). I'm using MVC2. I created a website in IIS 7.5 (on my Windows 7 machine) then pointed the physical directory at my Visual Studio project file Enabled only Forms Authentication in IIS ...

Html.ActionLink with a specified HTML id?

I'd like to give the like generated with an Html.ActionLink an HTML id so I can change the CSS depending on where I am. I have a masterpage with a set of links and I'd like to distinguish the active "Tab" with Jquery changing the css of that active #id Right now I'm using <%: Html.ActionLink("Some View", "Index", "controller")%> It g...

Publishing to IIS7 fileshare results in HTTP ERROR 403.13

I have an test server setup that is running a version of the site I am working on. I change nothing on the server (IIS and whatnot). I have a share mapped to a directory below where the site is running from. I publish into the directory from VS2010. When I hit the site the next time, I get "HTTP Error 403.14 - Forbidden - The Web ser...

IIS6 MVC2 Server starts sending out 404 after a while

I have a W2k3 server running IIS6 and MVC2 (.net 4). Right after the iis starts, everything works ok, the site runs fine. Extensionless urls work ok. After a certain period of time (maybe of inactivity) the server stops working and starts to send 404 errors to the client. As soon as I restart de application pool, everithing goes back ...

ASP.NET MVC 2 DataAnnotation: Server side validation for Required always fails on DateTime object

I am getting a strange issue with DataAnnotations in ASP.NET MVC 2which I am unable to get the hand of. I am trying to validate a DateTime In a Model Class I have defined private DateTime _dateFrom; [Required(ErrorMessage="Date is required")] public DateTime DateFrom { get { return _dateFrom; } set { _dateFrom = value; } } On...

Help me understanding MVC.NET

I am used to working with ASP.NET FORMS and I am having a hard time understanding MVC.NET. If I in WebForms would create a profile page for a user, it would consist of an aspx page with several usercontrols added on the page, which all does something differently. One control might show the latest posts by the user, another the friends ...

Problem in Webtest - while running test containing file upload.

Hi, We've web application developed using MVC2. I am recording webtests for all views in our web app. I'm using VS2008 test edition installed on separate machine for these webtests. My problem is - my recorded webtests fail for a view. THis particular view contains 2 upload controls. Common errors are - 1. Request failed: Empty path na...

NHibernate with MVC 2 Deployment issue.

I am deploying Asp.Net MVC 2 application on Windows Server 2003. I am using NHibernate for data access. When I deployed this application on Windows server 2003 and browse to it the application throws an exception saying "hibernate.cfg.xml not found under Windows/System32/inetsrv." Why NHibernate is searching Windows/System32/inetsrv ra...

Substitute for Spring's init-method and destroy-method attributes in Unity

Hi everyone. I worked for about a year on a big Java based project which uses Struts2 for MVC support and Spring for DI, and now, because of a shift in company's management I have to migrate my whole project to .NET. I started poking around with Unity and MVC2, and since I have to replicate my previous solution, I was wondering does Un...

Issue with MVC2 DropDownListFor, only displaying the class-name

Good day, I have this problem with Html.DropDownListFor which I can't seem to work out.. It gives me the correct number of options, if I do a breakpoint in the code where it is supposed to render the list, the "SelectItemList" object contains the items with correct values, but the actual HTML it spits out is the following: <select id="...

MVC 2 and castle ioc

Hi, I am trying to upgrade my mvc 1 app to mvc 2. Previously I was using Castle Core 1.1.0 but had to get the latest version 2.5 to work with mvc 2. I now get the following error. Could not load file or assembly 'Castle.Core, Version=2.5.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc' or one of its dependencies. The located as...