asp.net-mvc-5

ASP.NET MVC StackOverflowException Loading dynamic menu from xml in Layout

一个人想着一个人 提交于 2019-12-23 05:12:22
问题 I try to put a dynamic menu (load from xml) in my Layout but I've got a StackOverflowException in PartialController.cs/MainMenu() I don't understand why my code throw a StackOverflowException because I don't have a loop (or I don't see it !). Layout.cshtml : .... <div id="menu"> @if (Request.IsAuthenticated) { Html.RenderAction("MainMenu", "Partial"); } </div> .... MainMenu.cshtml : @model Geosys.BoT.Portal.POC.Business.Menu @foreach (var item in Model.Nodes) { <ul> <li> @item.Name <ul>

create breadcrumb with MvcSiteMap in mvc5

◇◆丶佛笑我妖孽 提交于 2019-12-23 05:12:14
问题 i want to create breadcrumb with MvcSiteMap in mvc5. i wrote below code. but i want to when i click on first , second , ... their Id pass to View. but it dose not work. i do it right? //Controller Name=News Home News first //id=1 second //id=2 third // id=3 About <mvcSiteMapNode title="Home" controller="Home" action="Index"> <mvcSiteMapNode title="News" controller="News" action="Index" key="News"> </mvcSiteMapNode> <mvcSiteMapNode title="About" controller="About" action="Index"/>

Owin authentication between MVC 5 and Web API (separate IIS applications)

走远了吗. 提交于 2019-12-23 04:56:26
问题 I have a working app with MVC5 and Web API (both different IIS applications) using Forms Authentication and Bearer token. Yes, they must remain two separate IIS applications. I am using the auth token as the username in my Forms Authentication cookie and that's how I am able to pass the token back and forth from MVC and Web API. I am also using Asp.net Identity 2.0. I would like to take Forms Authentication out of the equation and just use Owin Authentication but the User.Identity

Owin authentication between MVC 5 and Web API (separate IIS applications)

我怕爱的太早我们不能终老 提交于 2019-12-23 04:55:46
问题 I have a working app with MVC5 and Web API (both different IIS applications) using Forms Authentication and Bearer token. Yes, they must remain two separate IIS applications. I am using the auth token as the username in my Forms Authentication cookie and that's how I am able to pass the token back and forth from MVC and Web API. I am also using Asp.net Identity 2.0. I would like to take Forms Authentication out of the equation and just use Owin Authentication but the User.Identity

Error using $expand with NHibernate and webapi + OData

删除回忆录丶 提交于 2019-12-23 03:57:17
问题 When you run the query {{odata-url-prefix}}/ArquivosVenda(2)?$expand=Vendas an error is generated: { "odata.error": { "code": "", "message": { "lang": "en-US", "value": "An error has occurred." }, "innererror": { "message": "Argument types do not match", "type": "System.ArgumentException", "stacktrace": " at System.Web.Http.ApiController.<InvokeActionWithExceptionFilters>d__1.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime

Creating a matrix of checkboxes which supports post back in ASP.NET MVC

别说谁变了你拦得住时间么 提交于 2019-12-23 03:44:10
问题 I'm trying to think of a way to manage the selection of a matrix of values via view models in MVC 5. I have a list of companies and a list of roles. The roles are the same for each company. What I want is to output a matrix of companies/roles with a checkbox for each combination. This allows the user to select which role the person will have for each company. I can render the output with nested foreach loops but I can't help but think there's a better way to achieve this with MVC and Editor

row span using MVC5

杀马特。学长 韩版系。学妹 提交于 2019-12-23 02:52:23
问题 @if (ViewData["post"] != null) { foreach (var item in ViewData["post"] as IEnumerable<Employee.Models.ApplyJob>) { <tr> <td>@item.PerferenceNo</td> <td>@item.JobName</td> <td>@item.Location</td> <td>Action</td> </tr> } } how to use row span on PerferenceNo and JobName using MVC4> 回答1: You need to compare the previous values with the current values, but there is no need to use rowspan (which would unnecessarily complicate it). You can just generate an empty <td> element when the cell matches

Invalidate ASP.NET Identity 2.0 login without removing the application cookie

泄露秘密 提交于 2019-12-23 02:36:52
问题 Background The application I'm working on is running on several different domains, all sharing the same database and IIS process. The user may switch between these domains by clicking a link, and should remain logged in when doing so. To accomplish this, when the switch domain link is clicked I create an entry in the database which contains the current value of the Identity 2 application cookie (named .AspNet.ApplicationCookie by default). The user is then redirected to the new domain, where

MVC5 Autofac: The view found at was not created

橙三吉。 提交于 2019-12-22 20:02:46
问题 I created very simple MVC 5.0 application that I push to GitHub repository: https://github.com/marxin/mvc-sample. My motivation is to execute app on Linux with mono 3.2.3. I would like to add Autofac NuGet package (more precisely 3.3.0), that works fine for me. Problem is that if I add Autofac.Mvc5 integration package, Razor stops working with following error: System.InvalidOperationException The view found at '~/Views/Home/Index.cshtml' was not created. Description: HTTP 500.Error processing

Concurrency in ASP .NET MVC 5 with Entity Framework

拈花ヽ惹草 提交于 2019-12-22 18:50:15
问题 I´m working on simple CMS in ASP .NET MVC 5 with Entity Framework. I have a few questions about concurrency in MVC´s applications. First of all - public section of my app (section for users without any authentification): All data (posts, category informations, tags, documents) are stored in DB (using Entity) In controllers for public section, there is only reading or writing data to DB, not deleting or editing So my first question - is it necessary to have some mechanisms to avoid concurrency