asp.net-mvc-2

ASP.Net MVC 2 on nginx/mono 2.8

纵然是瞬间 提交于 2019-12-03 03:19:09
I am trying to setup ASP.Net MVC 2 application on Linux environment. I've installed Ubuntu 10.10 on VirtualBox, then installed Mono 2.8 from sources. After that I have installed nginx and configure it as recommended here . Unfortunately, FastCGI shows me standard error 500 page: No Application Found Unable to find a matching application for request: Host localhost:80 Port 80 Request Path /Default.aspx Physical Path /var/www/mvc/Default.aspx My application is located in /var/www/mvc directory. I've tried to create some stub Default.aspx file and place it in root dir of my application, but it

Best practice for http redirection for Windows Azure

﹥>﹥吖頭↗ 提交于 2019-12-03 03:18:04
问题 I have an azure website which is named: http://myapp.cloudapp.net Of-course this URL is kind of ugly so I set up a CNAME that points http://www.myapp.com to the azure url. All is well up until here, but there is a snag. http://myapp.cloudapp.net has leaked out and now is indexed by google and lives on other sites. I would like to permanently redirect any requests for myapp.cloudapp.net to the new home at www.myapp.com The website I have is coded in MVC.Net 2.0, as this is an azure app, there

Using ValueInjecter to map between objects with different property names

左心房为你撑大大i 提交于 2019-12-03 03:08:39
How do I map a property from an object to another object with a different property name? I have a Product class that looks like this: public class Product : IEntity { public int Id { get; set; } public string Name { get; set; } } And the view model looks like: public class ProductSpecificationAddViewModel { public int ProductId { get; set; } public string ProductName { get; set; } } I need to do the following mapping: Product.Id => ProductSpecificationAddViewModel.ProductId Product.Name =>ProductSpecificationAddViewModel.ProductName Here is my action method: public ActionResult Add(int id) {

Creating child nodes for a DynamicNode in MvcSiteMapProvider that have dynamic parameters

会有一股神秘感。 提交于 2019-12-03 02:02:11
问题 I am using MvcSiteMapProvider 2.2.1 (http://mvcsitemap.codeplex.com), and am having a problem with creating children under a dynamic node (using a dynamicNodeProvider) when those children have a dynamic parameter (id). I am losing breadcrumbs for the following route: Stores/5/Products/Edit/23 where the url pattern is: Stores/{storeID}/{controller}/{action}/{id} It works fine when the ID is left out (ie the "New" action). But when the ID is specified, it doesn't match the route, and my

An Ideal Folder Structure for .NET MVC [closed]

空扰寡人 提交于 2019-12-03 01:39:48
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 6 years ago . When I started in .NET Webforms I didn't have much trouble finding a folder structure to follow since VS offered you application

MsBuild and MsDeploy with multiple environments

女生的网名这么多〃 提交于 2019-12-03 01:02:54
问题 Are there good patterns for mapping solution configurations to environments and using MsDeploy for packaging per environment? Shortest version: Grab this file, and try to change the .msbuild file so that a package is created. Details I have a solution with a large number of libraries and an ASP.NET MVC application. I drive the build with an msbuild file that calls the main solution and then does other things. I want to use the new msdeploy packaging to prepare a .zip file for later

Html.ActionLink with a specified HTML id?

吃可爱长大的小学妹 提交于 2019-12-03 00:59:10
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 generates: <a href="/controller">Some View</a> I'd like to generate: <a id="something" href="/controller">Some View</a> Is that possible? I've tried: <%: Html.ActionLink("Some View", "Index", "controller", new {id="blahbla")%> But that generates: <a href="

ASP.NET MVC3 Partial View naming convention

泪湿孤枕 提交于 2019-12-03 00:57:25
I'm new to the MVC development so please bear with me. Is it really necessary to name my partial view like _Action.cshtml (with the _ underscore) to comply with the naming convention? Here's my problem I have a controller (StudentController) and an action (List) that has a partial view file named "List.cshtml", and have @{ Html.RenderAction("List", "Student"); } to display this inside my HomeController - Index view as partial view which works. But if I name my partial view to _List.cshtml of course it will not work. Visual Studio could not even find the view for my action Student - List

FormsAuthenticationTicket.expiration v web.config value timeout

▼魔方 西西 提交于 2019-12-03 00:46:15
This is an MVC2 website, I am having a problem with a FormsAuthentication ticket. A user timeouts after 30 minutes cannot re-login. During testing, the DateTime.Now.AddMinutes(30) value was set to 5000 and everything was ok, but it has now changed to 30 and that is when then the problem started From cookie creation FormsAuthenticationTicket ticket = new FormsAuthenticationTicket( 1, user.UserID, DateTime.Now, DateTime.Now.AddMinutes(30), false, "user,user1", FormsAuthentication.FormsCookiePath); Web.config file <authentication mode="Forms"> <forms loginUrl="~/Account.mvc/LogOn" timeout="2880"

How to pass an enum to Html.RadioButtonFor to get a list of radio buttons in MVC 2 RC 2, C#

℡╲_俬逩灬. 提交于 2019-12-03 00:03:21
I'm trying to render a radio button list in MVC 2 RC 2 (C#) using the following line: <%= Html.RadioButtonFor(model => Enum.GetNames(typeof(DataCarry.ProtocolEnum)), null) %> but it's just giving me the following exception at runtime: Templates can be used only with field access, property access, single-dimension array index, or single-parameter custom indexer expressions. Is this possible and if so, how, please? You can create a template called "Enum" in /Views/Shared/EditorTemplates/Enum.ascx With the following content: <%= Html.DropDownList(string.Empty, Enum.GetNames(Model.GetType())