asp.net-mvc-5

Having separate projects in one ASP.NET MVC 5 solution

痴心易碎 提交于 2019-12-10 13:20:17
问题 I want to have many projects(like 20) in one ASP.NET solution. All projects would have their own databases, models, views and controllers. Can you tell me how I can do that? And how the urls would be? If there is one project in the solution it is like this : localhost:12345/Controller/View When there are more projects, would the correct configuration like this ? : localhost:12345/ProjectName/Controller/View One more thing, I am planning to use Identity 2.0 Framework. Is it possible for a user

Cannot logoff of identity MVC 5 application

天涯浪子 提交于 2019-12-10 13:19:55
问题 I'm making a new (empty template) ASP.NET MVC 5 application and I cannot logoff of this app. My logoff Action: public ActionResult LogOff() { if (User.Identity.IsAuthenticated) { //break here } try { AuthenticationManager.SignOut(); if (User.Identity.IsAuthenticated || Request.IsAuthenticated) { //break here; } } return RedirectToAction("Login", "Account"); } Startup class: public partial class Startup { public void ConfigureAuth(IAppBuilder app) { app.UseCookieAuthentication(new

“CacheProfile” in MVC 5

强颜欢笑 提交于 2019-12-10 12:57:42
问题 I am beginner in MVC and I have a project to transform from MVC2 to the latest version of MVC. I read read some books on MVC 4, so I started to understand the main mechanisms. However, when transforming my MVC 2 solution, I have a problem with an attribute: OutputCache . By eg. I have multiple Actions like this (the attributes may vary): [OutputCache(CacheProfile = "ProductImage")] public ActionResult GetImage(Guid elementId, int imgtype) in the Web.Config i have in the "caching

Visual Studio 2015 New MVC Project - the mvc does not exist in Microsoft.Aspnet

孤街醉人 提交于 2019-12-10 12:45:59
问题 I'm getting an error in Visual Studio 2015 I was using windows 8.1 and visual studio 2013 and all projects with asp.net MVC 5 were working and developing fine without any error. Since I installed windows 10 and visual studio 2015 my whole ASP.NET MVC 5 project doesn't work well. I created new default template in visual studio 2015 to check them. I got the same error on those new project also. I get errors as : CS0234 The type or namespace name 'Mvc' does not exist in the namespace 'Microsoft

There was an error running the selected code generator: 'Object reference not set to an instance of an object.' Error?

我的未来我决定 提交于 2019-12-10 12:38:35
问题 I have tried all the solution like repairing the VS 2013 but no use. when you create a controller by right clicking on the Controller folder and you add the controller, then you right click in the Action of the newly created controller and select Add View, it happens right then, when I try to create a view. Its not a new project, its an existing project. 回答1: I had this issue on my VS2017 and i solved it by doing this: Go to C:\Users\username\AppData\Local\Microsoft\VisualStudio\15.0_7fca0c70

VS2015 add reference for Class Library

吃可爱长大的小学妹 提交于 2019-12-10 12:34:13
问题 I have created a project in VS2015, structure as below: Solution1 BookStore.ClassLibrary1 => Class Library (Package) BookStore.ClassLibrary2 => Class Library BookStore.Web => MVC5 In BookStore.Web, I can reference BookStore.ClassLibrary2 , but fail to reference BookStore.ClassLibrary1 . It shows an error " A reference to 'ClassLibrary1' could not be added. " My question is how to reference a Class Library (Package) in VS2015? Thank you so much! 回答1: Looks like your ClassLibrary1 project is a

UserManager always null in ASPNET Identity 2 app

☆樱花仙子☆ 提交于 2019-12-10 12:32:16
问题 Setup: I have an MVC 5 app with a number of library projects, created using my own exported templates. The exported templates have been working fine. I am using ASPNET Identity. I am just using a copy of the Microsoft Aspnet Identity Sample as supplied in the relevant NuGet package, that I have woven into my exported templates. This has been working fine. I have not touched the files supplied in the ASPNET Identity 2 sample. The error happens in the IdentityConfig.cs file. For some reason, it

How to fix the beginner's ReactJS error?

北城以北 提交于 2019-12-10 11:47:30
问题 I'm beginner in ReactJS and am trying to run the following code: @{ ViewBag.Title = "Index"; } <h2>Hello World-React JS</h2> <script src="https://code.jquery.com/jquery-2.2.0.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.14.6/react.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.14.6/react-dom.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.23/browser.min.js"></script> <script type="text/javascript">

Difference between AJAX Helper and async/await

空扰寡人 提交于 2019-12-10 11:39:41
问题 While reviewing the tutorial videos by Scott Allen on Plural Sight: Building Applications with ASP.NET MVC 4 and ASP.NET MVC 5 Fundamentals I came across 2 different terms: AJAX Helper and async/await . It "sounds" to me both operate on the asynchronous mode (correct me if I'm wrong). What exactly is the difference between each? 回答1: They are actually completely different. The key to understanding the difference is to think about the HTTP protocol. In the HTTP protocol, you have one request

mailto link encoding in MVC Razor

☆樱花仙子☆ 提交于 2019-12-10 11:38:43
问题 I have the following model public class EmailLinkModel { public string mailbody { get; set; } public string emailSubject { get; set; } public string emailto { get; set; } } mailbody contains the actual text which is a part of mail body. This text contains a long text [ contains special characters like ? < etc and can contain line breaks spaces etc] I want to create a mailto html tag in the partial view and i tried 3 different approaches and at some point my mailto link not opening the default