asp.net-mvc-5

Create and Run MVC 5 Project in VS 2012

回眸只為那壹抹淺笑 提交于 2019-12-17 06:13:12
问题 For some reason my Visual Studio 2013 Preview cannot create MVC 5 Projects. Since the MVC project is now open source in CodePlex I was wondering if there's a simple way to develop MVC 5 projects in my Visual Studio 2012 Ultimate. 回答1: A new tutorial has been recently added to the ASP.NET website on how to upgrade an MVC4 project to MVC5. I migrated a VS 2012 project using this tutorial without problems, but there is no design time support for Razor 3 in VS2012 due to changes in the way VS

MVC5, AjaxHelper, and the Correct Scripts & Load Order

蹲街弑〆低调 提交于 2019-12-17 04:35:42
问题 OK, I find it EXTREMELY ridiculous that I have to post a new question to find the answer but, alas here I am. Let's make this as simple as possible for the next wayward soul looking to resolve this. What are all the most current scripts I require to get the ajax form working? Thus far I have; <script src="//ajax.aspnetcdn.com/ajax/jQuery/jquery-1.11.0.js"></script> <script src="//ajax.aspnetcdn.com/ajax/jquery.ui/1.10.4/jquery-ui.min.js"></script> <script src="//ajax.aspnetcdn.com/ajax/jquery

How do I forcefully propagate role changes to users with ASP.NET Identity 2.0.1?

给你一囗甜甜゛ 提交于 2019-12-17 04:29:29
问题 I've read this and while it explains how role changes will eventually propagate to the user cookie after some time interval, I still don't understand how I force an immediate change to user roles. Do I really have to sign the user out when I change his roles as administrator? If so — how? If I use AuthenticationManager.SignOut(); then I sign off myself (admin), not the user, whose roles I want to change. Currently I use await UserManager.UpdateSecurityStampAsync(user.Id); to generate a new

How do I forcefully propagate role changes to users with ASP.NET Identity 2.0.1?

99封情书 提交于 2019-12-17 04:29:06
问题 I've read this and while it explains how role changes will eventually propagate to the user cookie after some time interval, I still don't understand how I force an immediate change to user roles. Do I really have to sign the user out when I change his roles as administrator? If so — how? If I use AuthenticationManager.SignOut(); then I sign off myself (admin), not the user, whose roles I want to change. Currently I use await UserManager.UpdateSecurityStampAsync(user.Id); to generate a new

Using JSON.NET to return ActionResult [duplicate]

狂风中的少年 提交于 2019-12-17 04:26:31
问题 This question already has answers here : Json.Net And ActionResult (2 answers) Closed 2 years ago . I'm trying to write a C# method that will serialize a model and return a JSON result. Here's my code: public ActionResult Read([DataSourceRequest] DataSourceRequest request) { var items = db.Words.Take(1).ToList(); JsonSerializerSettings jsSettings = new JsonSerializerSettings(); jsSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore; var converted = JsonConvert.SerializeObject(items,

Why new fb api 2.4 returns null email on MVC 5 with Identity and oauth 2?

时光毁灭记忆、已成空白 提交于 2019-12-17 02:44:08
问题 Everything used to work perfect until fb upgraded it's api to 2.4 (I had 2.3 in my previous project). Today when I add a new application on fb developers I get it with api 2.4. The problem: Now I get null email from fb ( loginInfo.email = null ). Of course I checked that the user email is in public status on fb profile, and I went over the loginInfo object but didn't find any other email address. and I google that but didn't find any answer. please any help.. I 'm kind of lost.. Thanks, My

Unauthorised webapi call returning login page rather than 401

人盡茶涼 提交于 2019-12-17 02:06:24
问题 How do I configure my mvc/webapi project so that a webapi method called from a razor view doesn't return the loginpage when its unauthorised? Its a MVC5 application which also has WebApi controllers for calls via javascript. The two methods below [Route("api/home/LatestProblems")] [HttpGet()] public List<vmLatestProblems> LatestProblems() { // Something here } [Route("api/home/myLatestProblems")] [HttpGet()] [Authorize(Roles = "Member")] public List<vmLatestProblems> mylatestproblems() { //

Pass List of Checkboxes into View and Pull out IEnumerable [duplicate]

喜欢而已 提交于 2019-12-16 18:50:13
问题 This question already has answers here : How does MVC 4 List Model Binding work? (5 answers) Closed 4 years ago . I have a list of items that will be associated to a user. It's a one-to-many relationship. I want the entire list of items passed into the view so that they can choose from ones that are not associated to them yet (and also see those that are already associated). I want to create checkboxes from these. I then want to send the selected ones back into the controller to be associated

Pass List of Checkboxes into View and Pull out IEnumerable [duplicate]

拥有回忆 提交于 2019-12-16 18:50:12
问题 This question already has answers here : How does MVC 4 List Model Binding work? (5 answers) Closed 4 years ago . I have a list of items that will be associated to a user. It's a one-to-many relationship. I want the entire list of items passed into the view so that they can choose from ones that are not associated to them yet (and also see those that are already associated). I want to create checkboxes from these. I then want to send the selected ones back into the controller to be associated

Search method issue

自闭症网瘾萝莉.ら 提交于 2019-12-14 04:22:58
问题 I'm using MVC 5, C# and I'm trying to build a search filter that will filter through upon each key stroke. It works as so, but the textbox erases after submitting. Now this is probably not the best approach to it either. Is there a way to make so when it posts it doesn't erase the textbox, or better yet, is there a better alternative? @using (Html.BeginForm("Index", "Directory", FormMethod.Post, new { id = "form" })) { <p> Search Employee: <input type="text" name="userName" onkeyup=