asp.net-mvc-2

Invalidate the whole output cache in asp .net MVC 2

[亡魂溺海] 提交于 2019-12-06 14:48:36
How is it possible to invalidate the whole output cache in asp .net mvc 2? AFAIK this is not possible. You can only invalidate specific actions that might have been cached by decorating them with the [OutputCache] attribute. HttpResponse.RemoveOutputCacheItem(Url.Action("Index", "Products")); While I don't know if there is a way to do it in code, still recycling the worker process might invalidate the server cache. If this is true then you might even do it in code by having code to do the recycling. 来源: https://stackoverflow.com/questions/4782569/invalidate-the-whole-output-cache-in-asp-net

ASP.NET MVC 2 i18n

被刻印的时光 ゝ 提交于 2019-12-06 14:41:02
问题 I found the following page on i18n and ASP.NET: http://wiki.asp.net/page.aspx/55/internationalization/ The videos were very helpful although they apply to ASP.NET WebForms more than ASP.NET MVC, e.g., the videos show you how to internationalize controls rather than text -- which leads me to another realization: there isn't (or I couldn't find) a resources folder in my MVC applications -- just folders like AppData. Is there a simple way (like in the videos) to internationalize plain text in

Visual Studio 2010 - web deploy times out - what to do?

匆匆过客 提交于 2019-12-06 14:32:08
My MVC2 web project is deployed using the VS 2010 "web deploy" feature. It used to run fine but now it is timing out more often than not with this error message: Web deployment task failed.((10/11/2010 1:01:59 a.m.) An error occurred when the request was processed on the remote computer.) (10/11/2010 1:01:59 a.m.) An error occurred when the request was processed on the remote computer. The remote host closed the connection. The error code is 0x800704CD. Searching for the error code 0x800704CD does not return anything helpful. Is there a way to increase the timeout period, or should I be

MVC ListBoxFor raises “value cannot be null” exception

岁酱吖の 提交于 2019-12-06 14:21:43
I am trying to use the Html.ListBoxFor helper to show a list box and return the selected Id. Is there a problem with the dataValueField not being a string? If the SelectList contained in the model uses integers as the dataValueField then I get a "Value cannot be null - Parameter name: Source" exception raised when the list is rendered in the view. If the Id is changed to a string then everything works and the selected Id is passed back to the view. Any ideas? Here is the controller (based on a cut down new project) namespace Mvc2.Controllers { public class ViewModel { public int TestId { get;

Redirect Authorization failure in mvc

心已入冬 提交于 2019-12-06 14:12:08
I have been doing this research for 2 days now, but i cant seem to find the answer. How to redirect user to a specific page This is what I have now: <authentication mode="Forms"> <forms loginUrl="~/Account/Member/LogOn" timeout="2880" /> </authentication> What i want to do is if user isn't authenticated redirect to this url: ~/Account/Member/LogOn" but if the user is already authenticated but not authorized, I want to redirect to this url: ~/Account/Member/Unauthorized" Is there anyway to do this without creating a custom authentication attribute?' Thanks Tae-Sung Shin You can make a base

missing ) after argument list error when using Ajax.ActionLink mvc2

帅比萌擦擦* 提交于 2019-12-06 14:09:58
问题 I've got this actionlink that is generating this error in firefox <%: Ajax.ActionLink(" ", "SelectEditProduct", new { id = item.Id }, new AjaxOptions { UpdateTargetId = "dialog", InsertionMode = InsertionMode.Replace, OnSuccess = "$(\"#dialog\").dialog(\"open\");"}, new { Class="edit"})%> It seems to be coming from the little javascript snippet I have. I escaped the quotations though so I'm stumped. 回答1: What I see here is that you are using jQuery alongside with Microsoft AJAX. Those two

Asp.Net MVC2 Clientside Validation and duplicate ID's problem

廉价感情. 提交于 2019-12-06 14:09:34
问题 I'm using MVC2 with VS2010 I have a view that has two partial views in it: "Login" and "Register" both partial views contains the Email address field i use the following in both partial views: <%: Html.TextBoxFor(model => model.EmailAddress ) %><br /><%: Html.ValidationMessageFor(model => model.EmailAddress) %> if i use both partial views on one page, it ends up having duplicate id's so validation happens across both views (even thopugh they are in seperate forms) how can i go about

log4net RollingFileAppender and IIS 7.5

守給你的承諾、 提交于 2019-12-06 13:45:34
I'm trying to use log4net with a RollingFileAppender on IIS 7.5 / Server 2008 R2. However, the configuration from my old IIS 6 / Server 2003 box doesn't appear to work anymore, I simply don't see any log files being created, here's what I've got setup: In Web.config (inside <configSections> ) <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/> In the same file (inside <configuration> ) <log4net> <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender"> <layout type="log4net.Layout.PatternLayout"> <conversionPattern value="%date [%thread]

Create new database programmatically in Asp.Net MVC application?

 ̄綄美尐妖づ 提交于 2019-12-06 13:36:53
I have worked on a timesheet application application in MVC 2 for internal use in our company. Now other small companies have showed interest in the application. I hadn't considered this use of the application, but it got me interested in what it might imply. I believe I could make it work for several clients by modifying the database (Sql Server accessed by Entity Framework model). But I have read some people advocating multiple databases (one for each client). Intuitively, this feels like a good idea, since I wouldn't risk having the data of various clients mixed up in the same database

mvc.net routing: routevalues in maproutes

对着背影说爱祢 提交于 2019-12-06 13:16:56
问题 I need urls like /controller/verb/noun/id and my action methods would be verb+noun. For example I want /home/edit/team/3 to hit the action method public ActionResult editteam(int id){} I have following route in my global.asax file. routes.MapRoute( "test", "{controller}.mvc/{verb}/{noun}/{id}", new { docid = "", action = "{verb}"+"{noun}", id = "" } ); URLs correctly match the route but I don't know where should I construct the action parameter that is name of action method being called. 回答1: