我正在使用jQuery.validate v 1.6.0来验证我的表单.
我的一个数据库字段限制为1000个字符.我在相应的textarea中添加了一个验证,如下所示:
在我的页面标题中,我添加
$('form.validate').validate();
Run Code Online (Sandbox Code Playgroud)
在我的页面内,我声明:
<form method="post" class="validate" action="Save">
<textarea name="description" minlength="15" maxlength="1000" id="description" class="required"></textarea>
<input type="submit" value="Save">
</form>
Run Code Online (Sandbox Code Playgroud)
我遇到的问题是,jQuery似乎将"新行"中涉及的字符数量与我的数据库不同.
当我输入没有新行的1000个字符时,一切顺利,验证工作正常.如果我用一些新行键入1000个字符,jQuery允许POST发生,但我的数据库拒绝插入/更新,因为数据太大.
任何提示将不胜感激.
我希望在ActiveDirectory中获得用户的组成员资格,而不在域中.当我在域内运行时,一切都很好.
var context = new PrincipalContext(ContextType.Domain);
var principal = UserPrincipal.FindByIdentity(context, IdentityType.Name, "administrator");
foreach (var authorizationGroup in principal.GetAuthorizationGroups())
{
Console.WriteLine(authorizationGroup.Name);
}
Run Code Online (Sandbox Code Playgroud)
但是,当我在域外运行时,我必须指定PrincipalContext:
var context = new PrincipalContext(ContextType.Domain, "10.0.1.255", "DC=test,DC=ad,DC=be", "administrator", "password");
Run Code Online (Sandbox Code Playgroud)
当我运行此代码时,执行时会出现异常principal.GetAuthorizationGroups()
.我得到的例外是:
System.DirectoryServices.AccountManagement.PrincipalOperationException: Information about the domain could not be retrieved (1355).
at System.DirectoryServices.AccountManagement.Utils.GetDcName(String computerName, String domainName, String siteName, Int32 flags)
at System.DirectoryServices.AccountManagement.ADStoreCtx.LoadDomainInfo()
at System.DirectoryServices.AccountManagement.ADStoreCtx.get_DnsDomainName()
at System.DirectoryServices.AccountManagement.ADStoreCtx.GetGroupsMemberOfAZ(Principal p)
at System.DirectoryServices.AccountManagement.UserPrincipal.GetAuthorizationGroupsHelper()
at System.DirectoryServices.AccountManagement.UserPrincipal.GetAuthorizationGroups()
Run Code Online (Sandbox Code Playgroud) 我正在使用FitNesse作为功能测试框架.当FitNesse运行需要配置的代码时,我遇到了麻烦.
如果我需要从配置文件中获取连接字符串,我可以通过将其添加到FitServer.exe.config来使其工作.但是,我不喜欢这个解决方案.我希望FitNesse加载我自己的配置文件,即TheNameOfMyApp.dll.config.
这可能吗?
是否有可能告诉模拟/存根在RhinoMocks中根本没有看到任何交互.有点像:
logger.AssertNoInteraction();
Run Code Online (Sandbox Code Playgroud)
哪个会断言在存根记录器上没有调用任何方法.
这比每次调用以下内容要简单得多:
logger.AssertWasNotCalled(l => l.Debug(Arg<string>.Is.Anything()));
logger.AssertWasNotCalled(l => l.Info(Arg<string>.Is.Anything()));
logger.AssertWasNotCalled(l => l.Warning(Arg<string>.Is.Anything()));
logger.AssertWasNotCalled(l => l.Error(Arg<string>.Is.Anything()));
Run Code Online (Sandbox Code Playgroud)