asp.net-mvc-5

Upgrade to ASP.NET MVC 5 Error 403.14 Forbidden

巧了我就是萌 提交于 2019-12-13 03:57:42
问题 I upgraded from ASP.NET MVC 4 to MVC 5, and my site stopped working. Accessing it from the internet gave a 403 - Forbidden: Access is Denied. Accessing it from the VM with the site gave the message Error 403.14 Forbidden The Web server is configured to not list the contents of this directory. In addition, the event log said there was an error loading System.Web.Mvc v 5. A lot of the answers for stuff like this said you had to re-register ASP.NET, but that is not allowed for IIS 8. 回答1: I'm

How To Switch _Layout view in MVC5

六月ゝ 毕业季﹏ 提交于 2019-12-13 03:36:21
问题 I Have a Table that contains different color of themes and I have define the _Layouts and css, I have apply the css to the their respectful layout. e.g _LayoutBlue _LayoutGreen I want to Check using a switch statement that when a user logins before rendering the view it should check the theme colour ID the user Choosed while creating an account and Apply to the User View the question is, Is it Possible for me to do that from the Login controller so as to control the rendering layout based on

Odd Session Behavior in ASP.NET

瘦欲@ 提交于 2019-12-13 03:03:56
问题 First off, this is my own project, not a homework assignment. Here's the situation. I have a web application (ASP.NET w/ MVC 5) and I use the session to store certain things (e.g. user info). Now, there are two tabs open, each on one part of the page. We will call them Tab A and Tab B. Here's the scenario: Tab A is open to Page A Tab B is open to Page B In Tab B, the user does an action which requires the update of a session variable. Thus, I write the new data to the session variable via an

Hosting Winnovative HTML to PDF Converter in Azure

烂漫一生 提交于 2019-12-13 02:57:44
问题 I am looking to port ASP.NET MVC 5 application to being hosted on Azure.We are looking at hosting our application in an Azure App Service. One of the dependancies I have is Winnovative's HTML to PDF converter. The converter does not work in a web service, this is a well known issue with the software. Winnovative's advice is: For the situations when you must use the converter in an Azure Website and you cannot deploy your web application as an Azure Web Role or Worker Role or install it on an

How to get textbox value in Action in asp.net MVC 5

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-13 02:53:29
问题 I want to send the value of textbox to the Action Method for searching the technology for that i want to get the value of textbox in Action. I have the following code :- @Html.TextBox("technologyNameBox", "", new { id = "technologyName", @class = "form-control", @placeholder = "Search For Technology" }) <span class="input-group-btn" style="text-align:left"> <a class="btn btn-default" id="searchTechnology" href="@Url.Action("SearchTechnology", "Technology", new {technologyName="technologyName"

unexpected token u in json at position 0 when parsing data

扶醉桌前 提交于 2019-12-13 02:43:29
问题 it is clear that I am one of many with this issue, I've been googling for the past hour or so but I cannot seem to fix my issue. I am trying to fetch data from my controller using AJAX to put into the jQuery FullCalendar, now that I am fairly confident about my controller, I still get an error saying: unexpected token U in json at position 0 so there has to be something wrong. here's the script I use to get data from my database in my Controller: [HttpPost, ActionName("List")] [WebMethod

How to get ride of customErrors completely in Web.Config?

假装没事ソ 提交于 2019-12-13 02:38:25
问题 I implemented a custom error handler for my MVC5 project and everything would be fine if it wasn't of the customErrors attribute. I'll explain: When I got an error in the application, I catch it inside void Application_Error from Global.asax like this: protected void Application_Error(object sender, EventArgs e) { var httpContext = ((HttpApplication)sender).Context; ExecuteErrorController(httpContext, Server.GetLastError()); } public static void ExecuteErrorController(HttpContext httpContext,

MVC5 Area not behaving properly

巧了我就是萌 提交于 2019-12-13 02:36:22
问题 This post is directly related to: MVC5 Area not working That post fixed the index.cshtml issue, however it did not resolve each view for that controller. For example: http://localhost:45970/Setup/Start gives the error that the resource cannot be found (basically a 404). However http://localhost:45970/Setup/Setup/Start brings up the correct page. So what needs to be reconfigured so that ALL views for that controller in the Setup Area will open properly? Edit 1 Code from SetupAreaRegistration

How to Redirect on Session End [duplicate]

风流意气都作罢 提交于 2019-12-13 02:33:46
问题 This question already has answers here : Session_End in Global.asax.cs not firing using forms authentication (3 answers) Closed 4 years ago . I am trying to redirect user to another page when session ends. This code will result "Object reference not set to an instance of an object." exception void Session_End(Object sender, EventArgs E) { HttpContext.Current.Response.Redirect("/"); } any idea how to do it ? 回答1: Session_End is fired internally by the server, based on an internal timer.

Action method didn't worked with [HttpPost] attribute in asp.net mvc

柔情痞子 提交于 2019-12-13 02:13:24
问题 To delete data in asp.net mvc 5 with Razor Engine , I wrote these code that works fine . I want to give it [HttpPost] attribute , but if I add that , action didn't worked . Could anyone help me what's the problem ? I have just one action named delete , I don't need another Delete action with [HttpGet] attribute . How can I fix it ? Repositories.cs public bool Delete(int id, bool autoSave = true) { try { var entity = db.Carousels.Find(id); db.Entry(entity).State = System.Data.Entity