asp.net-mvc-5

How can I use Bootstrap button addons in my MVC view

拥有回忆 提交于 2020-01-01 09:17:10
问题 I'm having difficulty getting Bootstrap's button addons to work in my MVC view. I'm using the latest NuGet version of ASP.NET MVC (5.1 rc1) and Bootstrap (3.03). I have the following in my view (now that I've pared it back to just hand-coded HTML rather than using Html.EditorFor() , in an attempt to getting it to work): @using (Html.BeginForm()) { @Html.AntiForgeryToken() <div class="form-horizontal"> @Html.ValidationSummary(true) <div class="row"> <div class="col-lg-6"> <div class="input

Custom Folder Structure in ASP.NET MVC 5

痞子三分冷 提交于 2020-01-01 08:55:55
问题 I'm trying to determine if it is possible (or practical) to implement Uncle Bob's Screaming Architecture in ASP.NET MVC 5 rather than using the default folder structure. Here's a link to a description of the Screaming Architecture: http://blog.8thlight.com/uncle-bob/2011/09/30/Screaming-Architecture.html A hypothetical folder structure would look something like this: Root Customers Controllers CustomerController.cs Models Customer.cs Views Index.cshtml Details.cshtml Update.cshtml Employees

Mvc retain values after postback

随声附和 提交于 2020-01-01 07:06:28
问题 I have a simple TestController class and User model: public class TestController : Controller { public ActionResult TestAction() { return View(); } [HttpPost] public ActionResult TestAction(User user) { return View(); } } public class User { public int Id { get; set; } public string Name { get; set; } public int Age { get; set; } } This is my form: As far as I know MVC is stateless and it does not have a viewstate concept. But after posting the data to my controller and when I return the view

Asp.net identity Google account id migration from openId to oauth

空扰寡人 提交于 2020-01-01 07:04:29
问题 I have an existing asp.net mvc5 application using DotNetOpenAuth for Google OpenId authentication. I am migrating to Asp.Net Identity, and using Google+ Auth with OAuth2.0. But I have seen thant I can't map existing OpenId account Id to OAuth2.0 Id : - Old id is : https://www.google.com/accounts/o8/id?id=blablabla - New Id is : a long number Since I would like to use new id, I am searching for help on migrating identities. I have not found yet a simple sample to achieve this. I am using a new

Asp.net identity Google account id migration from openId to oauth

无人久伴 提交于 2020-01-01 07:04:21
问题 I have an existing asp.net mvc5 application using DotNetOpenAuth for Google OpenId authentication. I am migrating to Asp.Net Identity, and using Google+ Auth with OAuth2.0. But I have seen thant I can't map existing OpenId account Id to OAuth2.0 Id : - Old id is : https://www.google.com/accounts/o8/id?id=blablabla - New Id is : a long number Since I would like to use new id, I am searching for help on migrating identities. I have not found yet a simple sample to achieve this. I am using a new

ASP.NET Identity 2 Invalidate Identity Difficulties

为君一笑 提交于 2020-01-01 06:45:06
问题 I have been updating my implementation of ASP.NET Identity all day today and I feel I'm on the last step, but just can't make it work. All I want to happen is to have the user's current session (if any) invalidated when something about them changes and to send them back to the login page. From the dozens of Identity related articles I've been reading today, I've settled that I have to override the OnValidateIdentity delegate, but it's just not working. Below is my code, I would really

MVC 5, EF 6 and Multirow(batch) editing

我怕爱的太早我们不能终老 提交于 2020-01-01 06:11:26
问题 Project: bring in a list of corporate card transactions and let the user fill in documentation to support each charge. Let user save all changes at once versus one record at a time. The View @using (@Html.BeginForm("Index", "CorpCardTransactions", FormMethod.Post)) { <table> <tr> <th></th> <th>Card Holder</th> <th>Post Date</th> <th>Transaction Date</th> <th>Payee</th> <th>Amount</th> <th>Description</th> <th>GL/Account</th> <th>Branch Code</th> <th>Receipt</th> </tr> @for (int i = 0; i <

Populate DropDownList in MVC 5

淺唱寂寞╮ 提交于 2020-01-01 05:46:06
问题 Here is my code for my AddNewProductViewModel using AccessorizeForLess.Data; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Web; namespace AccessorizeForLess.ViewModels { public class AddNewProductViewModel { public string Name { get; set; } [DataType(DataType.MultilineText)] public string Description { get; set; } public decimal Price { get; set; } public string AltText { get; set; } public int Quantity { get; set; } public string ImagePath { get;

OWIN with LDAP Authentication

旧时模样 提交于 2020-01-01 05:21:07
问题 Here is my scenario. I have an MVC 5 application that uses Owin as an authentication mechanism. The default template calls the SignInManager.PasswordSignInAsync in the Login action which I would like to overwrite to use LDAP to validate the user instead of looking into the database. I am able to do the validation via: PrincipalContext dc = new PrincipalContext(ContextType.Domain, "domain.com", "DC=domain,DC=com", "user_name", "password"); bool authenticated = dc.ValidateCredentials(userName,

Redirect to Action by parameter mvc

半城伤御伤魂 提交于 2020-01-01 04:14:07
问题 I want to redirect to an action in other Controller but it doesn't work here's my code in ProductManagerController: [HttpPost] public ActionResult RedirectToImages(int id) { return RedirectToAction("Index","ProductImageManeger", new { id=id }); } and this in my ProductImageManagerController: [HttpGet] public ViewResult Index(int id) { return View("Index",_db.ProductImages.Where(rs=>rs.ProductId == id).ToList()); } It redirect to ProductImageManager/Index without parameter very well(no error)