asp.net-mvc-2

ASP MVC + AJAX, trying to Update a div asynchronously

天涯浪子 提交于 2019-12-23 12:17:34
问题 I'm new to Asp MVC, and I'm trying to accomplish a little async update (I'm using MVC3 RC2, with Razor, but I can manage with ASPX solutions too). I have a Master page, which renders a shopping cart box on every page by calling Html.RenderAction("Cart","Shop"). The Cart action of the ShopController calls the database, etc, and outputs the results. This works. First problem: if I put an ActionLink in this partial view (like Html.ActionLink("Remove")), then even if I call PartialView() from the

ASP.NET MVC: Can an MSI file be returned via a FileContentResult without breaking the install package?

孤者浪人 提交于 2019-12-23 11:59:17
问题 I'm using this code to return a FileContentResult with an MSI file for the user to download in my ASP.NET MVC controller: using (StreamReader reader = new StreamReader(@"c:\WixTest.msi")) { Byte[] bytes = Encoding.ASCII.GetBytes(reader.ReadToEnd()); return File(bytes, "text/plain", "download.msi"); } I can download the file, but when I try to run the installer I get an error message saying: This installation package could not be opened. Contact the application vendor to verify that this is a

ASP.NET MVC 2, Ninject 2.2 and no parameterless constructor defined for this object

风格不统一 提交于 2019-12-23 10:29:32
问题 So I've been spending some time with ASP.NET MVC 2 (currently stuck with using Visual Studio 2008) and have now moved onto using Ninject 2.2 and its MVC integration. I've downloaded Ninject 2.2 and Ninject.Web.Mvc from the following locations: https://github.com/downloads/ninject/ninject/Ninject-2.2.0.0-release-net-3.5.zip https://github.com/downloads/ninject/ninject.web.mvc/Ninject.Web.Mvc2-2.2.0.0-release-net-3.5.zip And referenced them in my MVC 2 project. My Global.asax.cs file looks like

ASP.NET MVC 2, Ninject 2.2 and no parameterless constructor defined for this object

吃可爱长大的小学妹 提交于 2019-12-23 10:28:46
问题 So I've been spending some time with ASP.NET MVC 2 (currently stuck with using Visual Studio 2008) and have now moved onto using Ninject 2.2 and its MVC integration. I've downloaded Ninject 2.2 and Ninject.Web.Mvc from the following locations: https://github.com/downloads/ninject/ninject/Ninject-2.2.0.0-release-net-3.5.zip https://github.com/downloads/ninject/ninject.web.mvc/Ninject.Web.Mvc2-2.2.0.0-release-net-3.5.zip And referenced them in my MVC 2 project. My Global.asax.cs file looks like

ASP.NET MVC : strange POST behavior

你离开我真会死。 提交于 2019-12-23 10:16:20
问题 ASP.NET MVC 2 app I have two actions on my controller (Toons): [GET] List [POST] Add App is running on IIS7 integration mode, so /Toons/List works fine. But when I do POST (that redirects to /Toons/List internally) it redirects (with 302 Object Moved) back to /Toons/Add. The problem goes away if I use .aspx hack (that works in IIS6/IIS7 classic mode). But without .aspx - GET work fine, but POST redirects me onto itself but with GET. What am I missing? I'm hosting with webhost4life.com and

Do I have to Load/Get an entity before SaveOrUpdate in Nhibernate?

删除回忆录丶 提交于 2019-12-23 08:08:21
问题 in my ASP.NET MVC application I've separated the domain model from the view model. I transform my entity in a viewmodel object so I can "feed" my views with only the data needed (I used valueinjecter for this purpose). During the save process my controller gets back the viewmodel object, transforms it into a domain model entity and try to persist it with SaveOrUpdate. I've noticed that if I try to update an existing record, Nhibernate considers it as a new object and forces an INSERT, even if

What is causing this error? Error executing child request for handler 'System.Web.Mvc.HttpHandlerUtil+ServerExecuteHttpHandlerWrapper'

冷暖自知 提交于 2019-12-23 08:05:44
问题 I can't figure out why I might be getting this error. It happens on an ajax call. Any help is appreciated. Thanks! This is the full error text: -- 6/21/2010 6:09:10 PM -- System.Web.HttpException (0x80004005): Error executing child request for handler 'System.Web.Mvc.HttpHandlerUtil+ServerExecuteHttpHandlerWrapper'. ---> System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.Web.HttpException (0x80004005): OutputStream is

What is causing this error? Error executing child request for handler 'System.Web.Mvc.HttpHandlerUtil+ServerExecuteHttpHandlerWrapper'

谁说我不能喝 提交于 2019-12-23 08:05:16
问题 I can't figure out why I might be getting this error. It happens on an ajax call. Any help is appreciated. Thanks! This is the full error text: -- 6/21/2010 6:09:10 PM -- System.Web.HttpException (0x80004005): Error executing child request for handler 'System.Web.Mvc.HttpHandlerUtil+ServerExecuteHttpHandlerWrapper'. ---> System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.Web.HttpException (0x80004005): OutputStream is

Knockout and MVC 2.0

▼魔方 西西 提交于 2019-12-23 07:54:50
问题 Does anyone know of an example application using knockout js and MVC 2? I'm trying to learn knockout and am having trouble grasping how to persist model data via an ajax call to an action. 回答1: There's a great post here by the author of Knockout on how to use it with MVC. In MVC 2 you can use the built in model binder instead of a [FromJson] attribute like the article suggests. Congrats on finding Knockout. My team has absolutely loved working with it. One of our guys replaced a dynamic

Knockout and MVC 2.0

为君一笑 提交于 2019-12-23 07:52:19
问题 Does anyone know of an example application using knockout js and MVC 2? I'm trying to learn knockout and am having trouble grasping how to persist model data via an ajax call to an action. 回答1: There's a great post here by the author of Knockout on how to use it with MVC. In MVC 2 you can use the built in model binder instead of a [FromJson] attribute like the article suggests. Congrats on finding Knockout. My team has absolutely loved working with it. One of our guys replaced a dynamic