asp.net-mvc-4

Unable to get webApi result in controller

北城余情 提交于 2020-08-11 18:46:12
问题 I am trying to create constraint for route.Based on the access info retrieved from Db,i will choose which route to choose. I have created controller inheriting IRouteConstraint and calling repository,but Unable to get result from httpclient call. Code snippet of my routeConfig routes.MapRoute( name: "Home", url: "{*routelink}", defaults: new { controller = "Home", action = "Index" }, constraints: new { routelink = new UserAccessController("Home") } ); routes.MapRoute( name: "Reports", url: "{

Unable to get webApi result in controller

北慕城南 提交于 2020-08-11 18:46:09
问题 I am trying to create constraint for route.Based on the access info retrieved from Db,i will choose which route to choose. I have created controller inheriting IRouteConstraint and calling repository,but Unable to get result from httpclient call. Code snippet of my routeConfig routes.MapRoute( name: "Home", url: "{*routelink}", defaults: new { controller = "Home", action = "Index" }, constraints: new { routelink = new UserAccessController("Home") } ); routes.MapRoute( name: "Reports", url: "{

A connection attempt failed because the connected party did not properly respond

被刻印的时光 ゝ 提交于 2020-08-09 14:00:51
问题 I have a shared server on 1and1. In my MVC site, when I try to connect to another server outside I get this error: An error occurred while sending the request. Unable to connect to the remote server A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 23.xxx.xxx.xxx:80 When I run it on my development machine locally it works fine, but when I upload it to server by

Compare radio button values using jquery

人走茶凉 提交于 2020-08-06 06:40:10
问题 In MVC 4 i am trying one scenario, i have 2 radio button sets,first set have the value of one,two three,four and second set consist of values one,two,three,four.When i select one in the first set the radiobutton holding value one in the second set should be disabled. I did like $(document).ready(function () { var EValue; var MValue; EValue = $("input:radio[name=E_message]:checked").val(); //Could be something like Mvalue = $("input:radio[name=M_message]).val(); if(EValue == MValue){ $("input

Compare radio button values using jquery

雨燕双飞 提交于 2020-08-06 06:39:47
问题 In MVC 4 i am trying one scenario, i have 2 radio button sets,first set have the value of one,two three,four and second set consist of values one,two,three,four.When i select one in the first set the radiobutton holding value one in the second set should be disabled. I did like $(document).ready(function () { var EValue; var MValue; EValue = $("input:radio[name=E_message]:checked").val(); //Could be something like Mvalue = $("input:radio[name=M_message]).val(); if(EValue == MValue){ $("input

remove required property from input field on form submit

别等时光非礼了梦想. 提交于 2020-08-01 03:21:38
问题 Model: [Display(Name = "City"] [Required] [RegularExpression(@"^(?!\d$).*$"] [StringLength(20,MinimumLength = 2] public string City { get; set; } Form: @Html.LabelFor(x => x.City, new { @class = "control-label" }) @Html.TextBoxFor(x => x.City, new {id="city" }) Script: <script> $(document).ready(function () { $("#identificationForm").submit(function (e) { var required=document.getElementById("city").required; console.log(required); // e.preventDefault(); }); }); </script> I want to remove

Strange whitespace appearing in MVC4 Razor View

折月煮酒 提交于 2020-07-08 04:20:24
问题 I'm developing an app in ASP.Net MVC4 and am having a strange issue with whitespace. I've developed plenty of MVC3 sites with Razor without this issue. Here's my template cshtml file: <!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width" /> <title>HF - Content Management - @ViewBag.Title</title> <link href="@Url.Content("~/content/bootstrap/bootstrap.min.css")" rel="stylesheet" /> @Styles.Render("~/bundles/css/hf-cms-logged-in") </head> <body> @Html.Partial(

Strange whitespace appearing in MVC4 Razor View

别等时光非礼了梦想. 提交于 2020-07-08 04:20:10
问题 I'm developing an app in ASP.Net MVC4 and am having a strange issue with whitespace. I've developed plenty of MVC3 sites with Razor without this issue. Here's my template cshtml file: <!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width" /> <title>HF - Content Management - @ViewBag.Title</title> <link href="@Url.Content("~/content/bootstrap/bootstrap.min.css")" rel="stylesheet" /> @Styles.Render("~/bundles/css/hf-cms-logged-in") </head> <body> @Html.Partial(

After Installing Win 8 Pro and IIS 8 - missing StaticFileModule

[亡魂溺海] 提交于 2020-06-28 01:19:06
问题 I've made new installation Win 8 Pro + IIS 8, but any static content (png and etc.) on my web site not working, because StaticFileModule in Modules IIS8 and static.dll are missing. What command enable StaticFileModule (static.dll) in IIS8 ? 回答1: Try installing the "Static content" feature using the "Turn Windows features on or off" menu: If for some reason the module is missing in ISS after installation, you can try to add it manually (use the "Configure Native Modules" option and copy the

How to make ASP.NET MVC Controller Methods Async

六月ゝ 毕业季﹏ 提交于 2020-06-26 07:29:28
问题 I'm launching multiple ajax calls to various MVC controllers to load different parts of my page. However it seems that when this gets to the controller only one runs at a time. I'm guessing this is because by default ASP.Net MVC controllers are synchronous? I've also tested loading a page on 2 browser tabs and the second tab always waits for the first. To get round this I've attempted to make the controller methods in question asynchronous. I've done this by doing the following Append Async