asp.net-mvc-5

ASP.NET MVC 5 OWIN Auhentication

我的未来我决定 提交于 2019-12-25 02:24:59
问题 I have just started to know the MVC 5 and I am trying to use its built in owin authentication. I need to implement a forms authentication with IIS, but the OWIN Authentication is complicated than i waited. I have az Entity Framework Model with own User, Role and RoleUser tables and want to authenticate user by these tables. I tried to figured it out, how the owin works on a sample mvc 5 application. It has an ApplicationUser class: public class ApplicationUser : IdentityUser { } public class

@html razor radio buttons mvc5

荒凉一梦 提交于 2019-12-25 02:12:19
问题 here's my viewmodel public class UserResponseModel { public string QuestionId { get; set;} public string QuestionText { get; set; } public bool IsChecked { get; set; } } so, for checkboxes this works beautifully for (var i = 0; i < Model.UserResponses.Count; i++) { <div class="row"> <div class="col-md-4"> <div class="form-group"> @Html.HiddenFor(x => x.UserResponses[i].QuestionId) @Html.CheckBoxFor(x => x.UserResponses[i].IsChecked) but for radio buttons this does not for (var i = 0; i <

Sent mail using smtp not working when deployed in microsoft windows azure c# asp.net mvc5

荒凉一梦 提交于 2019-12-25 02:11:38
问题 I've been trying unsuccessfully to get an email in my Azure Website. I can get it working on my localhost using either the GMail SMTP settings. However when deployed to my windows azure website ,even on my localhost IIS it doesn't work. none mail being sent or received!!! there is my code in web.config: <appSettings> <add key="webpages:Version" value="3.0.0.0" /> <add key="webpages:Enabled" value="false" /> <add key="ClientValidationEnabled" value="true" /> <add key=

Opening a Column chart after clinking on DRILLEDOWN PIE Charts in dotnet highcharts

六月ゝ 毕业季﹏ 提交于 2019-12-25 01:46:25
问题 I am using Highsoft.Web.Mvc.Charts .I have a PIE chart and its drilled down NOW I want to open a column chart after clicking on any point of drilled down pie chart. My code in view is <script src="https://code.highcharts.com/highcharts.js"></script> <script src="https://code.highcharts.com/modules/exporting.js"></script> <script src="https://code.highcharts.com/modules/drilldown.js"></script> @using Highsoft.Web.Mvc.Charts @{ Highcharts chart2 = new Highcharts { Title = new Title { Text =

Binding mediator (shortbus) with/to ninject

人盡茶涼 提交于 2019-12-25 01:43:48
问题 I am trying to use the mediator pattern with shortbus(https://github.com/mhinze/ShortBus). Everything goes great except binding it to ninject. There is a structuremap example like so public BasicExample() { ObjectFactory.Initialize(i => { i.Scan(s => { s.AssemblyContainingType<IMediator>(); s.TheCallingAssembly(); s.WithDefaultConventions(); s.AddAllTypesOf((typeof(IRequestHandler<,>))); s.AddAllTypesOf(typeof(INotificationHandler<>)); }); i.For<IDependencyResolver>().Use(() =>

How do I edit a FormCollection value, and then use TryUpdateModel with the edited collection?

谁说我不能喝 提交于 2019-12-25 01:31:30
问题 MVC5 is storing my passwords in plaintext. I don't want to use the default hashing algorithm, as I'm required to use e.Encrypt() instead. I'm creating a registration function, and I need to know how I can edit values from FormCollection before using TryUpdateModel . Here's the code: [HttpPost] public ActionResult Register([Bind(Include = "User,Pass,Email")] FormCollection form) { var user = new Users(); string Hash = e.Encrypt(form["Pass"]); // Gets set. if (TryUpdateModel(user, form)) {

add-migration : Cannot bind argument to parameter 'Path' because it is null

蓝咒 提交于 2019-12-25 01:24:34
问题 I want to enable migration in visual studio 2017. When I run it, I'm getting an error. The error message is: add-migration : Cannot bind argument to parameter 'Path' because it is null. At line:1 char:1 + add-migration ApplyAnnotationsToCustomerName + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidData: (:) [Add-Migration], ParameterBindingValidationException + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Add-Migration. I tried to uninstalling

How to Set and Retrieve Session in ASP.NET MVC 5?

南笙酒味 提交于 2019-12-25 01:02:38
问题 I am working on an ASP.NET MVC 5 application and I am having problem storing data to session. The value I get is always null. Here is where I set the session: string mail = user.Email; string response = user.CheckEmail(); Session["email"] = mail; I am testing the session here, It is redirecting to YYY: if ((string)Session["mail"] != null) { return RedirectToAction("PPP"); } else { return RedirectToAction("YYY"); } Please immediate help will be appreciated. Thanks 回答1: You have typo. Session[

Rendering html code in view which is generated in controller of asp.nt mvc

久未见 提交于 2019-12-25 00:43:30
问题 I am implementing a role based menu. I have to generate the menu from the database dynamically. I have a role-feature mapping table from where I can get the features that are mapped to the role. Once I get that I have to generate the HTML menus with <ul> and <li> . Can I get suggestion as to how that be done. I mean generating the HTML script in controller and rendering it on to the respective view. Please help. Any suggestion is welcomed. <ul id="menu"> <li> @Html.ActionLink("Home",

Claims Identity anti-forgery exception with brand newly templated website with Individual User Authentication

末鹿安然 提交于 2019-12-24 22:53:09
问题 I used the MVC5 web template to create a new site with Individual User authentication and when I try to run it I get: System.InvalidOperationException: 'A claim of type 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier' or 'http://schemas.microsoft.com/accesscontrolservice/2010/07/claims/identityprovider' was not present on the provided ClaimsIdentity. To enable anti-forgery token support with claims-based authentication, please verify that the configured claims provider