ASP.NET 4.5 has not been registered on the Web server
Maybe you have to execute the following in the Visual Studio Tools command prompt: aspnet_regiis -i You can read more about the ASP.NET IIS Registration Tool (Aspnet_regiis.exe) here.
Maybe you have to execute the following in the Visual Studio Tools command prompt: aspnet_regiis -i You can read more about the ASP.NET IIS Registration Tool (Aspnet_regiis.exe) here.
The ApiController has a property called Url which is of type System.Web.Http.Routing.UrlHelper which allows you to construct urls for api controllers. Example: public class ValuesController : ApiController { // GET /api/values public IEnumerable<string> Get() { // returns /api/values/123 string url = Url.Route(“DefaultApi”, new { controller = “values”, id = “123” }); return new string[] { … Read more
See the summaries below each quote for a quick answer, and the paragraphs for detail. Also see the References section at the end for the authoritative sources. Summaries 1.What is SimpleMembership/SimpleMembershipProvider (WebMatrix.WebData) and what is it/are they responsible for? SimpleMembership (a term that covers both the SimpleMembershipProvider and SimpleRoleProvider) is responsible for providing a clean … Read more
Basically, Should everything be done through the viewmodel or is it Ok to also incorporate viewbag? Everything should be done inside a view model. That’s what a view model is. A class that you specifically define to meet the requirements of your view. Don’t mix ViewBags with ViewModels. It is no longer clear for the … Read more
You can put them in separate namespaces, e.g MyApp.Controllers.UsersController and MyApp.Controllers.WebAPI.UsersController. This would let you expose similar URI routes in MVC and WebAPI, eg: /users/1 << MVC view /api/users/1 << Web API
If you try to parse a form that is already parsed it won’t update What you could do when you add dynamic element to the form is either You could remove the form’s validation and re validate it like this: var form = $(formSelector) .removeData(“validator”) /* added by the raw jquery.validate plugin */ .removeData(“unobtrusiveValidation”); /* … Read more
Found an answer here by Mehdi Golchin which seems to take care of: [Authorize(Roles=”admin,editor,publisher”)] If I also add this to the home controller: [InitializeSimpleMembership] Because this attribute is on the Accounts controller, SimpleMembership database gets initialize only after the first use of the accounts controller like login/register. Even when the current user gets logged in … Read more
The following code, in my Global.asax, works for me: public static void RegisterWebApiFilters(System.Web.Http.Filters.HttpFilterCollection filters) { filters.Add(new MyWebApiFilter()); } protected void Application_Start() { RegisterWebApiFilters(GlobalConfiguration.Configuration.Filters); }
This is happening because the anti-forgery token embeds the username of the user as part of the encrypted token for better validation. When you first call the @Html.AntiForgeryToken() the user is not logged in so the token will have an empty string for the username, after the user logs in, if you do not replace … Read more
Update Version 1.1.x is available, read the release notes: https://www.nuget.org/packages/Microsoft.AspNet.Web.Optimization The Microsoft.Web.Optimization package is now obsolete. With ASP.NET (MVC) 4 and higher you should install the Microsoft ASP.NET Web Optimization Framework: Install the package from nuget: Install-Package Microsoft.AspNet.Web.Optimization Create and configure bundle(s) in App_Start\BundleConfig.cs: public class BundleConfig { public static void RegisterBundles(BundleCollection bundles) { bundles.Add(new … Read more