asp.net-mvc-5

Security Exception for default MVC 5 application

混江龙づ霸主 提交于 2019-12-02 09:42:37
I got security exception when deploying the default MVC 5 app generated with VS 2013 to my hosting account. Is there any quick solution for this problem? Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file. Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=4.0.0.0, Culture=neutral,

Does Grid.MVC work with ASP.NET MVC 5?

天大地大妈咪最大 提交于 2019-12-02 09:35:00
问题 Before I start messing around with something that doesn't work: Does Grid.MVC work with ASP.NET MVC 5? On gridmvc.codeplex.com they just write MVC3/4, but I wonder if anybody tried it with MVC5? You tried it, but it didn't work? Did you use any free alternative? Any help appreciated! Thanks! 回答1: Try this one: http://mvc-grid.azurewebsites.net it is more up-to-date. MVC 5: Install-Package NonFactors.Grid.Mvc5 MVC 6: Install-Package NonFactors.Grid.Mvc6 回答2: Yes it works in MVC5. The website

When deploying MVC app on server ajax cant find action but Localhost it does

吃可爱长大的小学妹 提交于 2019-12-02 08:46:25
I have a MVC5 application. When I run it on my localhost everything works without any errors. When I publish my app then I transfer it to Windows Server 2016, I put the files in wwwroot in the IIS folder and I link everything to create a new website in IIS. I then run the website and it works. I get my javascript code to work, but when I go and run my ‘ajax’ methods I get an 404 error and in the function I cannot find my controller action so the method will work. Here is my actual error: xxx.xxx.xx x.219/Parts/DoPartBookFunc?bookval=8 404 (Not Found), Failed to load resource: the server

jQuery validate plugin is not working in MVC form

孤街浪徒 提交于 2019-12-02 08:46:20
I have a MVC form like this <head> <script src="~/Scripts/jquery-1.8.3.js"></script> <script src="~/Scripts/jquery.validate.js"></script> </head> <body> <form action="" method="get" id="login"> <input id="email" class="text required email" type="text"> <input type="submit" value="Login..."> </form> <script> $(function () { $("#login").validate() }); </script> </body> but for some reason when i click on the submit button the jquery validate is not working and i get an error like this Uncaught TypeError: $(...).validate is not a function but when i use the same html in a normal html page along

MVC5 Asp.net Is there a way to get the correct value from EditorFor for a subclass

ε祈祈猫儿з 提交于 2019-12-02 08:38:29
I have a class public class Citizen { public long ID { get; set; } public string Name { get; set; } public long CityID { get; set; } public string City { get; set; } public List<CitizenResource> Resources { get; set; } } I want to edit individual items in the Resources but the EditorFor doesn't set up the input correctly. @for (int i = 0; i < Model.Resources.Count; i++ ) { @Html.BeginForm("EditResource", "Citizen") { @Html.AntiForgeryToken() <div class="form-horizontal"> <div class="form-group"> <p class="form-control-static"> @Html.DisplayFor(model => model.Resources[i].Name) </p> <div class=

WebAPI Put returns HTTPResponseMessage null

 ̄綄美尐妖づ 提交于 2019-12-02 08:15:07
I have a requirement to implement simple edit functionality.I am using webapi service to update my test object. I am calling the below method from the controller post request. This is the controller which calls a metod in test calls wich inturn calls the put service public ActionResult TestEdit(Test test) { if (ModelState.IsValid) { // objTest is returned null HttpResponseMessage objtest = TestDatabaseService.TestEdit(test.testID, test); } } // Method which calls put service testDataService public HttpResponseMessage TestEdit(int id, Test test)** { string uri = baseUri + "Test/" + id; using

UserManager updating a user record but creating a new record as well

廉价感情. 提交于 2019-12-02 08:03:01
I'm trying to update 2 records: a user record (bool and custom Object) a custom object (named MoviesDB) I'm using UserManager like so: private UserManager<ApplicationUser> UserManager = new UserManager<ApplicationUser>(new UserStore<ApplicationUser>(new ApplicationDbContext())); and the code is: using (ApplicationDbContext dbCtx = new ApplicationDbContext()) { // user to update var user = UserManager.Users .ToList() .First(u => u.Id == User.Identity.GetUserId()); // movie to update var movie = db.MoviesDBs.SingleOrDefault(m => m.ID == id); // this is the only property i want to update movie

ASP.NET MVC FileResult is corrupting files

柔情痞子 提交于 2019-12-02 07:01:59
I've been trying to get my ASP.NET MVC website to export some data as an Excel file. For hours I thought that NPOI was just producing garbage so I switched over to EPPlus. I tested it in LINQPad and it created a proper working XLSX file, so I moved the code over to the MVC app. AGAIN, I get corrupted files. By chance I happened to look at the temp directory and saw that the file created by EPPlus is 3.87KB and works perfectly, but the FileResult is returning a file that's 6.42KB, which is corrupted. Why is this happening? I read somewhere that it was the server GZip compression causing it, so

Bootstrap table sorting, filtering, pagination using dataTable.js

一世执手 提交于 2019-12-02 06:50:36
I am working on asp.net MVC-5 and created a Bootstrap table to show data Now i want to apply pagination, filtering and sorting, for this i searched may articles and found this link , the technique is very simple in this link and it's same to what i am doing in my project. Bellow i have included my .js and .css files <link href="~/Content/bootstrap.css" rel="stylesheet" /> <link href="~/Content/bootstrap.min.css" rel="stylesheet" /> <script src="~/Scripts/jquery-3.1.0.js"></script> <link href="~/Content/jquery.dataTables.min.css" rel="stylesheet" /> <script type="text/javascript" src="~/Scripts

Bootstrap table sorting, filtering, pagination using dataTable.js

笑着哭i 提交于 2019-12-02 06:47:25
问题 I am working on asp.net MVC-5 and created a Bootstrap table to show data Now i want to apply pagination, filtering and sorting, for this i searched may articles and found this link, the technique is very simple in this link and it's same to what i am doing in my project. Bellow i have included my .js and .css files <link href="~/Content/bootstrap.css" rel="stylesheet" /> <link href="~/Content/bootstrap.min.css" rel="stylesheet" /> <script src="~/Scripts/jquery-3.1.0.js"></script> <link href="