asp.net-mvc-5

Unsupported media type when uploading using web api

大憨熊 提交于 2019-12-11 13:25:44
问题 I am currently migrating a service to utilise asp.net web api from mvc. I have this ApiController [Authorize] public class UploadController : ApiController { private readonly ObjectService service; private readonly string companyId; public UploadController() { this.companyId = "D49AA22B-3476-4FAC-8BEF-38F53F9378F3"; this.service = new ObjectService(ConfigurationManager.AppSettings["AWSAccessKey"], ConfigurationManager.AppSettings["AWSSecretKey"], this.companyId); } // POST api/upload/5

Sass SCSS by BundleTranslator

六月ゝ 毕业季﹏ 提交于 2019-12-11 12:47:17
问题 I have set up the BundleTranslator in my MVC 5 project via NuGet (BundleTransformer.SassAndScss v1.9.96 with the Core and LibSassHost components). Next I have added the bundle reference to my View.cshtml @Styles.Render("~/Content/sass") and redefined the BundleConfig.cs : var nullOrderer = new NullOrderer(); var commonStylesBundle = new CustomStyleBundle("~/Content/sass"); commonStylesBundle.Include("~/Content/Custom/the-style.scss"); commonStylesBundle.Orderer = nullOrderer; bundles.Add

Exception thrown when using Glimpse and Postal

不打扰是莪最后的温柔 提交于 2019-12-11 12:43:20
问题 I'm just starting to use Glimpse with my MVC5 project and have run into an issue when I use Postal to send an email without disabling Glimpse. I've been able to narrow it down to an issue with both packages - it doesn't occur if the Glimpse cookie has not been turned on. In Fiddler, I checked the difference between the two. When it threw the exception, the cookie was glimpsePolicy=On when it worked (Glimpse was off) there were two cookies glimpseId=FBar; glimpsePolicy= The exception I get is

EF7 commands do not work in VS2015 CTP 6

守給你的承諾、 提交于 2019-12-11 12:28:37
问题 I'm trying to run ef7 migration on fresh asp.net 5 preview project. Steps I took: Created fresh project based on template "ASP.NET 5 preview starter web" Build it Try command Add-Migration in Package Manager console Result: The term 'Add-Migration' is not recognized as the name of a cmdlet, function, script file, or operable program. I also try this command: Install-Package EntityFramework.Commands -Pre I think for VS 2015 project is redundant, it executed but still Add-Migration was not

How to choose displayed text on Html.DropDownListFor

烂漫一生 提交于 2019-12-11 12:17:13
问题 How can I choose which property is displayed in Html.DropDownListFor for a some type? For example I have the following class from which I want to select values public partial class Artysta { public Artysci() { this.SpektaklArtysta = new HashSet<SpektaklArtysta>(); } [Key] public int ArtystaID { get; set; } public string Imie { get; set; } public string Nazwisko { get; set; } } Here is a generated code for edit View which sometimes displays Imie and from time to time Nazwisko . @using (Html

MvcSiteMapProvider No Separetor

扶醉桌前 提交于 2019-12-11 12:04:31
问题 I don't want the MvcSiteMapProvider to display the " > " separtor betweent the breadcrumbs. Example: Home > Contact What I want: Home Contact (a separetor between the breadcrumbs is added with CSS). I dodn't found any property called "separetor" to set this in the docu (https://github.com/maartenba/MvcSiteMapProvider/wiki). 回答1: MvcSiteMapProvider uses templated HTML helpers. You can edit the templates any way you want to change the output HTML to meet your needs (including the separator

Is it possible to have multiple Shared folders in MVC, and execute a RenderPartial to a Partial View in the other shared folder?

南楼画角 提交于 2019-12-11 11:39:21
问题 In MVC5, I know you can have a Shared folder under Views and then use the RenderPartial to render in partial views. Is there only ever one Shared folder for the whole website?, or is it possible to have multiple 'Shared' areas? For instance, I have the following structure on my website:- \Views \Views\Shared \Controllers \Models \Identity \Identity\Views \Identity\Controllers \Identity\Models I was wondering if it would also be possible for the Identity folder to have its own Shared folder as

Diagnosing login redirect loop

不羁的心 提交于 2019-12-11 11:37:24
问题 My ISP has recently had several permission issues on my site which is hosted on a shared IIS box. My MVC5 application has no code on the default page which requires authentication, but there are areas which do I have webpublished my application to a subdirectory "test" and I'm currently getting a infinite redirect loop when I try to load any of the [AllowAnonymous] pages which as a result give a 404. http://www.mywebsite.co.uk/test/Account/Login?ReturnUrl=%2Ftest%2FAccount%2FLogin%3FReturnUrl

Adding Identity 2.0 Roles to custom Identity

馋奶兔 提交于 2019-12-11 11:19:02
问题 I recently started work on a new application using MVC 5 and Identity 2.0, in order to use a different password hashing algorithm I implemented the custom identity detailed in this guide (https://code.msdn.microsoft.com/ASPNET-45-MVC5-Custom-1a94ab26#content). I have looked at various ways of incorporating roles into this identity implementation but so far have not found a way of making them work with this new identity implementation. Does anyone now of a guide on how to go about adding roles

Why is there an implementation difference between the UserStore and the RoleStore?

柔情痞子 提交于 2019-12-11 11:13:51
问题 This has no problems: public class ApplicationUserStore : UserStore<ApplicationUser, ApplicationRole, string, ApplicationUserLogin, ApplicationUserRole, ApplicationUserClaim> { public ApplicationUserStore(MyAppDb context) : base(context) { } } While this: public class ApplicationRoleStore : RoleStore<ApplicationRole, string, ApplicationUserRole> { public ApplicationRoleStore(MyAppDb context) : base(context) { } } ...produces the following compile time error: The type 'MyApp.Models