Tag: asp.net

通过jQuery调用ASP.NET服务器端的方法

我试图通过jQuery从客户端调用服务器端方法。 我的代码如下: 服务器端: using System.Web.Services; [WebMethod()] //[ScriptMethod()] public static void SendMessage(string subject, string message, string messageId, string pupilId) { //Send message } 客户端: $("#btnSendMessage").live("click", function(){ var subject = $("#tbSubject").val(); var message = $("#tbMessage").val(); var messageId = $("#hdnMessageId").val(); var pupilId = $("#hdnPupilId").val(); $.ajax({ type: "POST", url: "./MessagePopup.aspx/SendMessage", data: ("subject=" + subject + "&message=" + message + […]

在IIS中,为什么窗口身份validation不会显示为我的Web应用程序的一个选项?

我正在阅读关于如何在IIS 7上为我的Web应用程序设置Windows身份validation 。 在描述中他们有作为一个选项在IIS中的窗口身份validation。 我有Windowsvalidation打开我的机器(我在Windows 7专业64位),我仍然没有看到它作为我的Web应用程序的身份validation选项之一。 为什么?

ASP.NET MVC4asynchronous控制器 – 为什么要使用?

我想了解为什么和什么时候应该使用async控制器操作。 最后,当我用它等待,它将等待操作完成,以返回视图。 例如 public async Task<ActionResult> TryMe() { await SomeActionAsync(); return View(); } 在这种情况下,如果我使用async或不使用async ,则Action将执行相同的时间。 如果我不想并行运行至less两个慢速操作(不依赖于对方),我看不到有任何理由使用async控制器操作。 如果我错了,请纠正我。 我想我在这里错过了一些东西。

完全从Visual Studio中删除“错误列表”

我想完全删除Visual Studio 2008中的“错误列表”,而不是禁用它,我希望它消失。 这让我感到无尽的无尽的折腾,我想我一定是“做错了”,但是我们只是想用VS,而不是每隔一个警告都会提醒一下。 我试过在选项(工具 – >选项)中编辑许多不同的字段,只是略微减less了出现错误列表的频率。 我也取消了错误,警告和消息。 它popup什么都不显示。 解开它也没有帮助。 也升级到VS 2010是不是一个select在这一点上。 我寻找一个解决scheme,如下所示:删除一个DLL或configuration文件负责这一点 此外,我还想要内联validation(小波浪标记等),但错误列表窗口让我烦恼。

aspnet_compiler发现System.Web.WebPages 1.0.0.0的错误版本,而不是2.0.0.0

我有一个ASP.NET MVC4项目在VS2010编译罚款。 为了部署的目的,我运行一个Nant脚本,尝试使用aspnet_compiler.exe预编译网站,但是我一直运行到与System.Web.WebPage的程序集引用问题 CS1705:Assembly'System.Web.Mvc,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35'使用'System.Web.WebPages,Version = 2.0.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35',它有一个更高版本比引用程序集'System.Web.WebPages,Version = 1.0.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35' 我的web.config中也有下面的程序集绑定: <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" /> <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" /> <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" /> <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" /> […]

字体文件不与ASP.NET Bundle一起加载

在我的ASP.NET MVC应用程序中,我使用Bundles来压缩css和js文件。 问题是 – 我启用优化模式后,字体不加载。 BundleTable.EnableOptimizations = true; 这是C#代码 public static void RegisterBundles(BundleCollection bundles) { RegisterStyles(bundles); BundleTable.EnableOptimizations = true; } private static void RegisterStyles(BundleCollection bundles) { bundles.Add(new StyleBundle("~/BundleStyles/css").Include( "~/Content/Styles/bootstrap/bootstrap.css", "~/Content/Styles/reset.css", "~/Content/Styles/gridpack/gridpack.css", "~/Content/Styles/fontFaces.css", "~/Content/Styles/icons.css", "~/Content/Styles/inputs.css", "~/Content/Styles/common.css", "~/Content/Styles/header.css", "~/Content/Styles/footer.css", "~/Content/Styles/cslider/slider-animations.css", "~/Content/Styles/cslider/slider-base.css")); } 这里是字体的CSS。 @font-face { font-family: ProximaNova; src: url('../Fonts/ProximaNova/ProximaNova-Bold.otf') format('opentype'); font-weight: bold; font-style: normal; } 这是CSS在页面中被引用的方式。 <link […]

IIS会话超时与ASP.NET会话超时

在IIS 6(和其他版本太afaik),在属性 – >主目录选项卡 – >configurationbutton – >选项选项卡中有会话超时设置。 看起来像这样: 在ASP.NET web.config中有一个SessionState设置,如下所示: <system.web> <sessionState timeout="120" /> <!– etc .. –> </system.web> 他们有什么关系吗? 他们设置相同的东西,还是不同的东西?

防伪cookie标记和表单字段标记在MVC 4中不匹配

我在ASP.NET MVC 4中使用默认login模块。我没有更改默认应用程序中的任何代码,我托pipe在共享服务器上。 我login后使用默认login页面。 我把浏览器闲置了一段时间。 然后,当我尝试使用[Authorize]属性执行任何控制器操作时,显然应用程序已redirect到login页面。 然后,我尝试再次login,当我点击loginbutton时会出现错误。 The anti-forgery cookie token and form field token do not match. login操作 // POST: /Account/Login [HttpPost] [AllowAnonymous] [ValidateAntiForgeryToken] public ActionResult Login(LoginModel model, string returnUrl) { if (ModelState.IsValid && WebSecurity.Login(model.UserName, model.Password, persistCookie: model.RememberMe)) { return RedirectToLocal(returnUrl); } // If we got this far, something failed, redisplay form ModelState.AddModelError("", "The […]

WCF:System.Net.SocketException – 通常只允许使用每个套接字地址(协议/networking地址/端口)

我有一个WCF服务和一个Web应用程序。 Web应用程序以连续方式(即轮询)调用此WCF服务。 在我们的生产环境中,我很less收到这个错误。 因为,这是一个内部活动,用户不知道何时抛出这个错误。 无法连接到http://localhost/QAService/Service.svc 。 TCP错误代码10048:每个套接字地址(协议/networking地址/端口)通常只允许使用一个127.0.0.1:80。 —> System.Net.WebException:无法连接到远程服务器—> System.Net.Sockets.SocketException:通常只允许使用每个套接字地址(协议/networking地址/端口)127.0.0.1 :80 我在dev / qa环境中重现这种行为时遇到了麻烦。 我已经确保客户端连接在try..catch..finally块中closures。 仍然不明白是什么导致这个问题..任何人意识到这一点? 注 :我已经看过这个问题 ,但似乎没有回答我的问题,所以它不是重复的问题。

如何解决在iis 7中,错误不能添加typesadd的重复收集条目和唯一键属性“值”

我创build了一个asp.net网站,并在iis 7中发布。我删除了iis 7的默认网站选项,并在iis 7中创build了新网站。当我点击默认文档时,我得到了错误,如“错误不能添加重复typesadd的集合条目将唯一键属性“值”设置为index.aspx“。 我在我的web.config文件中使用了下面的代码。 <?xml version="1.0"?><configuration> <configSections> <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/> <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere"/> <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" […]