asp.net-mvc-5.1

Predefined type System.Object is not defined or imported

自古美人都是妖i 提交于 2019-12-04 23:46:16
I'm having this weird error only in .cshtml files in VS 2015. The error doesn't show up when I open the project with VS 2013. Error CS0246 The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?) here are my references: <ItemGroup> <Reference Include="Microsoft.CSharp" /> <Reference Include="Sitecore.Kernel, Version=7.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>N:\XXX\Sitecore.Kernel.dll</HintPath> </Reference> <Reference Include="Sitecore.Mvc"> <HintPath>N:\XXX\Sitecore.Mvc

MVC5 and Bootstrap3: Html.EditorFor wrong class? How to change?

无人久伴 提交于 2019-12-04 22:43:45
I just noticed that MVC 5 is using a different class for input fields when using EditorFor. I think its from a lower version of bootstrap, so the current class doesn't really add up. I'm talking about this: <div class="form-group"> @Html.LabelFor(model => model.Contact.CellphoneNo, new { @class = "control-label col-md-4"}) <div class="col-md-8"> @Html.EditorFor(model => model.Contact.CellphoneNo) @Html.ValidationMessageFor(model => model.Contact.CellphoneNo) </div> </div> Which results to this: <div class="form-group"> <label class="control-label col-md-4" for="Contact_CellphoneNo">CellphoneNo

Change username in MVC 5

人走茶凉 提交于 2019-12-03 07:49:38
I am using ASP.NET MVC5 and Identity 2.0 (beta). It is possible for users to change the username? I am trying using UserManager.UpdateAsync method throws an exception. Regrads, Fran. Yes it is possible using the UpdateAsync method but you need to ensure that you update both the email and username fields. var user = userManager.FindById(userId); user.Email = email; user.UserName = email; var updateResult = await userManager.UpdateAsync(user); This method works successfully for me This works for me: public async Task<ActionResult> ChangeUsername(string value) { if (UserManager.Users.Where(x => x

Supporting Individual User Accounts AND Organizational Accounts in MVC5 / ASP.Net Identity 2

送分小仙女□ 提交于 2019-12-03 06:53:22
问题 I've created an ASP.Net MVC5 application, in which I have configured (and have working fine) Individual User Accounts via Google, Facebook, etc. What I'd like to do is also support authentication against Azure Active Directory (Organizational Accounts). This would be for internal staff to be able to logon to the app as administrators. All existing information/guides/documentation I've found typically deals with using one or the other. How would I enable them both together? If there needs to

How do I properly register AutoFac in a basic MVC5.1 website?

岁酱吖の 提交于 2019-12-03 03:08:11
问题 AutoFac has recently been updated for MVC 5.1 but at the time of writing I find that the documentation is lacking (especially for a simple example). I would like to inject dependencies into MVC Controllers and register my own implementations for e.g. e-mail (actual sending vs print to output window) as a basic example. I'm do not know if I am missing a good resource for this and I am slight concerned that because it uses the OWIN specification that the implementation may differ for MVC5.1

Supporting Individual User Accounts AND Organizational Accounts in MVC5 / ASP.Net Identity 2

℡╲_俬逩灬. 提交于 2019-12-02 19:28:49
I've created an ASP.Net MVC5 application, in which I have configured (and have working fine) Individual User Accounts via Google, Facebook, etc. What I'd like to do is also support authentication against Azure Active Directory (Organizational Accounts). This would be for internal staff to be able to logon to the app as administrators. All existing information/guides/documentation I've found typically deals with using one or the other. How would I enable them both together? If there needs to be a separate logon form for each type of user, that would not be an issue. EDIT: I was looking at the

How do I properly register AutoFac in a basic MVC5.1 website?

▼魔方 西西 提交于 2019-12-02 17:41:01
AutoFac has recently been updated for MVC 5.1 but at the time of writing I find that the documentation is lacking (especially for a simple example). I would like to inject dependencies into MVC Controllers and register my own implementations for e.g. e-mail (actual sending vs print to output window) as a basic example. I'm do not know if I am missing a good resource for this and I am slight concerned that because it uses the OWIN specification that the implementation may differ for MVC5.1 (ASP.NET Identity uses OWIN and there is some special attributes used to properly instantiate OWIN) so

Jquery 2.1.1 in IE9 get error: 0x800a01b6 - Microsoft JScript runtime error: Object doesn't support property or method 'addEventListener'

依然范特西╮ 提交于 2019-12-01 15:29:41
问题 Using Visual Studio 2013, I migrated a hybrid Asp.Net Webforms/MVC 3 web application to Asp.Net Webforms/MVC 5.1. As part of the migration I upgraded Jquery from 1.9.1 to 2.1.1, using the NuGet package manager. When I run the application in the Visual Studio 2013 debugger in Chrome I have no problem. When I run the application in the Visual Studio 2013 debugger in IE 9 (compatibilty mode is not on) a master page with these two script tags loads first: <script src="/Scripts/jquery-2.1.1.js"

Entity Framework Seed method exception

有些话、适合烂在心里 提交于 2019-12-01 05:06:07
问题 I am using Entity Framework 6 with an MVC5 webapi2 project against an Oracle database. I am trying to add some ApplicationRoles in the Seed method, but when I execute update-database I get this exception: Running Seed method. System.Runtime.Serialization.SerializationException: Type is not resolved for member 'Oracle.ManagedDataAccess.Client.OracleException,Oracle.ManagedDataAccess, Version=4.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342'. at System.AppDomain.DoCallBack

How to find the right route in a RouteCollectionRoute?

馋奶兔 提交于 2019-11-30 18:16:30
I am testing ASP MVC routes . I am having an issue with attribute routes in ASP MVC 5.1 When I have a controller like this: public class FooController : Controller { [Route("foo")] [HttpGet] public ActionResult Get() { .... } [Route("foo")] [HttpPost] public ActionResult Post() { .... } } Then in order to test which route matches a particular request, I call routes.GetRouteData . I get a System.Web.Routing.RouteData that contains the route as well as values that should say which controller and action are matched. The problem is that this route is now an instance of RouteCollectionRoute this