草庐IT

application_helper

全部标签

c# - 设计 : How to inform controllers about data modification across application

在基于mvc的大型系统中,有负责编辑数据的View和显示该数据的View。示例:UserManagementView和UserSelectionView.每个子系统都应该知道自己是否需要更新数据,在另一个子系统对相同数据进行更改后,以便其Controller知道是否需要更新数据。我对此的想法有点像观察者模式(有点集成在c#中),所有Controller都将成为监听器,并最终会收到发生数据操纵的通知。BindingList例如提供ListChanged事件。同样,可以为每个数据结构创建一个接口(interface),并将更改通知Controller。这会增加开销(IMO),而且我发现这种

c# - ASP.NET MVC 3 - microsoft-web-helpers v1.1 的问题

我从nuget升级了我的microsof-web-helpers包,它本身依赖于facebook和twitterAPI。现在,当我的应用程序尝试运行时,出现以下错误:编译器错误消息:CS0246:找不到类型或命名空间名称“SimpleMembershipProvider”(是否缺少using指令或程序集引用?)SourceError:Line216:}Line217:Line218:privatestaticSimpleMembershipProviderGetMembershipProvider(){Line219:varprovider=Membership.ProviderasS

c# - 我怎样才能创建一个像 Html.BeginForm 这样的 Html Helper

我有一个扩展方法,可以根据角色验证用户是否能够看到网页的一部分。如果我简单地删除内容,这会给我带来更多的工作,因为所有丢失的表单在保存时都不会正确注册,我必须通过修改我的所有代码来处理这种行为,所以我想为什么不只使用display:none;属性?我想要这样的东西:@using(Html.RoleAccess(currentUser,RoleAccessType.Content_General_Website)){...}这会写成这样:...或者如果用户有权访问则使用display:block;...我可以创建一个简单的HtmlHelper但我如何编写一个也输出结尾的?publicst

c# - 响应消息的内容类型 application/xml;charset=utf-8 与绑定(bind)的内容类型不匹配 (text/xml; charset=utf-8)

我尝试使用独立应用程序使用WCFWeb服务。我可以使用InternetExplorer查看此服务,也可以在VisualStudio服务引用中查看。这是我遇到的错误Thecontenttypetext/html;charset=UTF-8oftheresponsemessagedoesnotmatchthecontenttypeofthebinding(text/xml;charset=utf-8).如何更改它以使用正确的内容类型?这是我的配置文件这是堆栈{System.ServiceModel.ProtocolException:Thecontenttypeapplication/xm

c# - MVC 中的 Razor 页面出现编译错误,未找到 System.Web.Helpers

我的razorview编译失败并出现以下错误:Description:Anerroroccurredduringthecompilationofaresourcerequiredtoservicethisrequest.Pleasereviewthefollowingspecificerrordetailsandmodifyyoursourcecodeappropriately.CompilerErrorMessage:CS0234:Thetypeornamespacename'Helpers'doesnotexistinthenamespace'System.Web'(areyoum

c# - 将 VB 转换为 C# - My.Application.Info.DirectoryPath

以下VB(VB.NET、VisualBasic)语句的最佳C#(csharp)等价物是什么:My.Application.Info.DirectoryPathMy.Computer.ClipboardMy.Computer.Audio.PlaySystemSound()My.Application.Shutdown() 最佳答案 应用程序.ExecutablePath系统.Windows.Forms.剪贴板系统.媒体.*应用程序.退出 关于c#-将VB转换为C#-My.Applicati

c# - 无法处理消息,因为内容类型 'application/json; charset=utf-8' 不是预期的类型 'text/xml; charset=utf-8'

我在通过ajaxjson调用WCF服务时收到上述响应。我的调用代码是:$(document).ready(function(){$.ajax({type:"POST",contentType:"application/json;charset=utf-8",url:"http://localhost:90/WebServices/UserService.svc/Calculate",data:"{}",timeout:10000,dataType:"json",success:function(response){alert(response)},error:function(xhr,

c# - 在 VS2015 中找不到 System.Web.Helpers

我正在尝试向VS2015中的C#代码添加一些JSON解析,但我找不到:系统.Web.Helpers如MS文档所建议的那样。我看过其他人的类似性质的问题(几乎都是早期版本),答案都说将其添加到程序集/框架对话框中。问题是它没有出现在那个对话框中,我看到人们谈论的许多其他事情也没有出现。如果能帮我解决这个问题,我将不胜感激。这是我有权访问的列表:编辑:同时添加了扩展窗口 最佳答案 这个问题有点老,但这里有一个简单的解决方案——微软似乎只是将这个库移动到一个名为“microsoft-web-helpers”的Nuget包中。安装该软件包似

c# - 不能包含 Microsoft.Security.Application?

我不能包含Microsoft.Security.ApplicationusingMicrosoft.Security.Application;给出这个错误:Thetypeornamespacename'Security'doesnotexistinthenamespace'Microsoft'(areyoumissinganassemblyreference?)是的,我点击了Bin->AddReference...->AntiXSSLibrary.dll并将其添加到包含AntiXSSLibrary.xml的Bin文件夹中。我重建了整个网站,但仍然一无所获。我正在使用ASP.NET3.5

c# - html helper 接受一个字典<string,object>,如何使用这个参数?

如果一个html助手将一个字典作为参数,我该如何使用它?我试过:但这行不通。 最佳答案 (){{"key","value"},{"key1",someObj},{"blah",1}}); 关于c#-htmlhelper接受一个字典,如何使用这个参数?,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/3257160/