asp.net-mvc

Dependency Injection and ModelStateWrapper

Hi, in tutorial Validating with a service layer constructor for Product Service looks like this: ProductService(IValidationDictionary validationDictionary, IProductRepository repository) and its instance in default controller constructor is created like this: public ProductController() { _service = new ProductService(new Mode...

ASP.Net MVC View Structure

I just finished Scott Gu's Nerd Diner tutorial. I found it very helpful because it not only taught the basics of ASP.Net MVC, but also how to use with Repositories, Validation, Unit testing, Ajax, etc.. Very thourough, but still manageable. However, I am curious about his site structure: Specifically, he used this view strucuture for ...

Can I store ASP.NET MVC routes in web.config?

I'm looking for a method of storing routing information in my web.config file in addition to the Global.asax class. The routes stored in the configuration file would need to take higher precedence than those added programmatically. I've done my searching, but the closest I can come up with is the RouteBuilder on Codeplex (http://www.cod...

Controller Path in ASP.NET-MVC

How do I get the path of a controller? For example, I can get the path of a HtmlHelper like this: private static string GetVirtualPath(HtmlHelper htmlhelper) { string virtualPath = null; TemplateControl tc = htmlhelper.ViewDataContainer as TemplateControl; if (tc != null) { virtualPath = tc.AppRelativeVirtualPath; } ...

Unit testing in asp.net MVC, how do I mock a page request?

How do I mock a page request for a .net MVC page? ...

Automatic model binding in asp.net

I've been using asp.net mvc and I like the facility given by UpdateModel & TryUpdateModel. Now I'm developing an application using the Web Client Software Factory. Are there any model binders I can use with this? ...

asp.net mvc - dynamic controller based on authenticated user

If I want the default url of my web app to display completely different UIs depending on the user, what is the best way to accomplish this? I don't really want to use the same controller for every type of user. To put it another way, if a user is logged in and goes to http://mysweetapp.com and is an admin user, they should get what they ...

Can asp.net ajax controls be used as pure client side controls?

So, my question is, can any of the ASP.NET Ajax controls from the Control Toolkit be used without their server-side controls and without an ASP.NET Ajax ScriptManager. For reference, I am asking in the context of an ASP.NET MVC application. Clearly, some of the controls don't make sense in this model because they do postbacks to the s...

How to add selected item into database using ASP.NET MVC

<% foreach (FoodMenu f in (IEnumerable)ViewData.Model) { %> <ul > <li><%= Html.Encode(f.ProductId) %> </li> <li><%= Html.Encode(f.Name) %></li> <li><%= Html.Encode(f.Price) %> </li> <li><%= Html.CheckBox("Selected") %></p></li> </ul> </div> ...

Is Asp.Net MVC + CSLA + DDD Possible

I was asked to review a system the other day that was based on ASP.NET MVC + CSLA + DDD (domain drive design). The first version of this system was based on ASP.NET MVC + CSLA. The second release was based on that plus added DDD. The reason is because..... well, I don't know what. As I looked at the diagrams from the two different ar...

Should ASP.NET MVC Views be Parameterized

In asp.net mvc, I have been thinking it would be more advantageous to specify parametrized constructors on the view classes in contrast to using ViewData to pass data to the view. In this way the view class could be instantiated in the action and returned from there as an implementation of IView for eventual rendering to the client by th...

MVC Nhibernate - Acces to path ???.hbm.xml denied

Hi, Vista, VS2008, MVC 1.0. I have a MVC app using FluentNHibernate to do the configruation. I have published the app to IIS7 on local machine. When I browse the app I get error 'C:\Users\Malcolm\Documents\Temp\MyProject.Domain.Ingredient.hbm.xml' is denied First thing is I am using FluentNhibernate so why is it using xml files for...

Safe to jump on ASP.NET MVC bandwagon when building enterprise solutions?

Before I get pointed to one of those 'VS.' questions like below... ASP.NET webforms + ASP.NET Ajax versus ASP.NET MVC and Ajax framework freedom Should I pursue ASP.NET WebForms or ASP.NET MVC ASP.NET MVC Web application vs ASP.NET Web Application ... please let me state that I'm not looking for a comparison. Some of my concerns tha...

User.Identity.Name is not returning the correct credentials when using Windows Authentication in ASP.NET MVC

I am using Windows Authentication in my ASP.NET MVC application and I am prompted to enter credentials on my webserver which is a domain member [I have domain credentials and can authenticate fine] however when my controller action calls "User.Identity.Name" in an attempt to check a database value against the currently logged in user thi...

ASP.NET MVC, SImple Create page across parent-child LINQ2SQL entity

I've got a simple structure Widget (parent table) id (IDENTITY) title WidgetChild (child table) - id (foreign key to widget.id) content On my View i have one field that captures the title, and another field that captures the content value. <%= Html.TextBox("title") %> and <%= Html.TextBox("content") %> How do i go abo...

Why not all form controls could be rendered via HtmlHelper?

Does anybody know why could some HTML form controls be rendered using System.Web.Mvc.HtmlHelper (hidden, checkbox, password, textbox) and some couldn't and should be explicitly written in HTML (file, submit)? What is the principle of this separation? ...

ASP.NET MVC And LINQ General Questions

I've asked a few questions on this topic before. Before we're able to implement either MVC or LINQ at work we need to resolve a few issues. Multiple Record Sets in ASP.NET MVC The only examples of MVC in use only have a single result set returned. When using stored procedures multiple record sets can be retrieved, and the whole reaso...

Parameter binding of POST action method

You can see what GET Delete action method passes DDW2File object to view. Is it possible somehow to bind this object back to ddw2file parameter of POST Delete action method? Now I have null value in it. Code fragment: public class DDW2FileController : Controller { ... public ActionResult Delete(string fileName) { r...

Problem using Html.ActionLink to call action on different controller

I am trying to navigate between controllers using ActionLink. I will tell my problem with an example. I am on Index view of Hat controller I am trying to use below code to create a link to Details action of Product controller. <%= Html.ActionLink("Details", "Details", "Product", new { id=item.ID }) %> Instead of creating me a link...

Azure Configuration Error

Guys, I am testing Azure and I keep running into this problem - I have no idea if anyone else has experienced something similar. Locally, the solution is working fine - no problems at all, but when I put it into the cloud - I just keep getting this error ? Any Ideas? Azure Configuration Error type="Microsoft.Samples.ServiceHosting.Asp...