asp.net-mvc-2

What are the Web.Debug.config and Web.Release.Config files for?

时光怂恿深爱的人放手 提交于 2019-11-27 00:10:57
I just upgraded to Visual Studio 2010 and MVC 2.0 and I noticed the Web.config has two additional files attached to it? Are these files used to specify debug and release specific settings, so you don't clutter up the main Web.config? Does it even make sense to place a connection string in the root Web.config file if I have a local and remote one in the debug and release Web.configs respectively? Thanks! It's the new Web.config transformation feature of Visual Studio 2010. More information here . Edit: Are these files used to specify debug and release specific settings, so you don't clutter up

Validating for large files upon Upload

≯℡__Kan透↙ 提交于 2019-11-27 00:09:57
I am working with c# MVC 2 and ASP.NET. One of my forms includes a file input field which allows a use to select any file type which will then be converted into a blob and saved into the database. My problem is that whenever a user selects a file that exceeds a certain amoutn of Mb (about 8) I get a page error that says the following: The connection was reset The connection to the server was reset while the page was loading. I don't mind that there's an 8Mb limit to the files the users are uploading however I need to stop the current error from happening and display a proper validation message

Can my MVC2 app specify route constraints on Query String parameters?

北城以北 提交于 2019-11-26 23:37:18
问题 My MVC2 app uses a component that makes subsequent AJAX calls back to the same action, which causes all kinds of unnecessary data access and processing on the server. The component vendor suggests I re-route those subsequent requests to a different action. The subsequent requests differ in that they have a particular query string, and I want to know whether I can put constraints on the query string in my route table. For example, the initial request comes in with a URL like http://localhost

What is the difference (if any) between Html.Partial(view, model) and Html.RenderPartial(view,model) in MVC2?

纵饮孤独 提交于 2019-11-26 23:29:27
Other than the type it returns and the fact that you call it differently of course <% Html.RenderPartial(...); %> <%= Html.Partial(...) %> If they are different, why would you call one rather than the other one? The definitions: // Type: System.Web.Mvc.Html.RenderPartialExtensions // Assembly: System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 // Assembly location: C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 2\Assemblies\System.Web.Mvc.dll using System.Web.Mvc; namespace System.Web.Mvc.Html { public static class RenderPartialExtensions { public static

Getting 404 error on MVC web-site

穿精又带淫゛_ 提交于 2019-11-26 23:15:15
问题 I have an IIS7.5 web-site, on Windows Server 2008, with an ASP.NET MVC2 web-site deployed to it. The website was built in Visual Studio 2008, targeting .NET 3.5, and IIS 5.1 has been successfully configured to run it as well, for local testing. However, whenever I try and navigate to a page running in IIS7, I get a 404 error. I have checked the following things: There is no corresponding 404 log entry in IIS logs. Actually, there are 404 entries in the IIS log. The application pool for the

How do I clear MVC client side validation errors when a cancel button is clicked when a user has invalidated a form?

痴心易碎 提交于 2019-11-26 22:50:21
问题 I have a partial view that is rendered within a main view. The partial view takes advantage of System.ComponentModel.DataAnnotations and Html.EnableClientValidation() . A link is clicked, and div containing the partial view is displayed within a JQuery.Dialog() . I then click the save button without entering any text in my validated input field. This causes the client side validation to fire as expected, and display the '*required' message beside the invalid field. When the cancel button is

MVC: How to post File Upload and other form fields to one action

谁都会走 提交于 2019-11-26 22:38:28
问题 I am creating a document library application with a DocumentController that needs to upload a thumbnail image of each doument in the library. I want to keep the File Upload field on the same Create/Edit form as the other fields (Title, Description, CategoryId etc). The problem is I'm not sure if I can mix or nest the form tags for Html.BeginForm("Create", "Document", FormMethod.Post, enctype = "multipart/form-data") and Html.BeginForm() My view is as follows: <%@ Page Title="" Language="C#"

Technique for carrying metadata to View Models with AutoMapper

纵然是瞬间 提交于 2019-11-26 22:37:02
问题 I use AutoMapper to map my domain objects to my view models. I have metadata in my domain layer, that I would like to carry over to the view layer and into ModelMetadata. (This metadata is not UI logic, but provides necessary information to my views). Right now, my solution is to use a separate MetadataProvider (independently of ASP.NET MVC), and use conventions to apply the relevant metadata to the ModelMetadata object via an AssociatedMetadataProvider. The problem with this approach is that

Session state can only be used when enableSessionState is set to true either in a configuration

不羁岁月 提交于 2019-11-26 22:13:50
I am working on Asp.net MVC 2 app with c# by using vs 2010.I am having below mentioned error when I run my app locally under debug mode. Error message image is as below : Error message text is as below : Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive. Please also make sure that System.Web.SessionStateModule or a custom session state module is included in the <configuration>\<system.web>\<httpModules> section in the application configuration. What I did for sort out this issue are as below : Try 1 : web.config file

Asp.Net MVC Controller: declarative AOP with Spring.Net

爱⌒轻易说出口 提交于 2019-11-26 22:08:17
问题 Is it possible, that Spring.Net Aspects don't work with Asp.Net Controller? I want to configure transactions on Action methods of Controllers but the proxy doesn't seem to trigger. <object id="ControllerClassPointcut" type="Spring.Aop.Support.SdkRegularExpressionMethodPointcut, Spring.Aop"> <property name="patterns"> <list> <value>xxx.Controllers.CompanyController.*</value> </list> </property> </object> <aop:config> <aop:advisor pointcut-ref="ControllerClassPointcut" advice-ref="TxAdvice"/> <