这是相关的代码.请注意,我在Notepad ++中这样做,而不是在我的代码中复制我的工作项目.如果我在其中拼错了一个类名,假设它在我的代码中没有拼写错误.没有编译错误.
模型:
public class MyViewModel
{
public int SelectedSomething { get; set; }
public IList<int> Somethings { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
控制器:
public class MyController
{
public ActionResult Index()
{
var viewModel = new MyViewModel();
viewModel.Somethings = Enumerable.Range(1, 12).ToList();
return View(viewModel);
}
}
Run Code Online (Sandbox Code Playgroud)
查看(剃刀):
@Html.DropDownListFor(x => x.SelectedSomething, new SelectList(Model.Somethings, Model.SelectedSomething), "Select an Option")
Run Code Online (Sandbox Code Playgroud)
这将"工作",但不会在以下任何渲染option元素上设置值select:
<select>
<option value="">Select an Option</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option>7</option>
<option>8</option>
<option>9</option>
<option>10</option>
<option>11</option>
<option>12</option>
</select>
Run Code Online (Sandbox Code Playgroud)
我知道的SelectList构造 …
我想转换自 JSONObject
{"CNo":80,"CName":"ganesh","CMail":"ganesh@ganesh.com","CMailType":"home","CPhNo":9878987776,"CPhNoType":"home","ClientNo":1}
至
{\"CNo\":80,\"CName\":\"ganesh\",\"CMail\":\"ganesh@ganesh.com\",\"CMailType\":\"home\",\"CPhNo\":9878987776,\"CPhNoType\":\"home\",\"ClientNo\":1}
我正在编写一项服务,允许用户注册并在事件发生时接收通知.我正在尝试使用netTcpBinding执行此操作,但即使在本地计算机上运行时也会遇到错误.
当我尝试发送通知时,我超时,收到此错误:
http://www.w3.org/2005/08/addressing/anonymous需要Stream Security ,但没有协商安全上下文.这可能是由远程端点从其绑定中丢失StreamSecurityBindingElement引起的.
为了测试我在一个控制台中托管服务,它正在为我打开,我可以看到WSDL并在其上运行svcutil.当我运行客户端时,尝试发送通知是在上面的错误出现时.
主机App.config:
<system.serviceModel>
<services>
<service name="CompanyName.WebServices.InterventionService.RegistrationService"
behaviorConfiguration="RegistrationServiceBehavior">
<endpoint address="http://localhost:8000/CompanyName/Registration"
binding="wsDualHttpBinding"
contract="CompanyName.WebServices.InterventionService.Interfaces.IRegistrationService"/>
<endpoint address="net.tcp://localhost:8001/CompanyName/Registration"
binding="netTcpBinding"
contract="CompanyName.WebServices.InterventionService.Interfaces.IRegistrationService"/>
</service>
<service name="CompanyName.WebServices.InterventionService.NotificationService"
behaviorConfiguration="NotificationServiceBehavior">
<endpoint address="http://localhost:8010/CompanyName/Notification"
binding="wsDualHttpBinding"
contract="CompanyName.WebServices.InterventionService.Interfaces.INotificationService"/>
<endpoint address="net.tcp://localhost:8011/CompanyName/Notification"
binding="netTcpBinding"
contract="CompanyName.WebServices.InterventionService.Interfaces.INotificationService"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="RegistrationServiceBehavior">
<serviceMetadata httpGetEnabled="true"
httpGetUrl="http://localhost:8000/CompanyName/Registration"/>
</behavior>
<behavior name="NotificationServiceBehavior">
<serviceMetadata httpGetEnabled="true"
httpGetUrl="http://localhost:8010/CompanyName/Notification"/>
</behavior>
<behavior name="netTcpRegistrationServiceBehavior">
<serviceMetadata httpGetEnabled="true"
httpGetUrl="net.tcp://localhost:8001/CompanyName/Registration"/>
</behavior>
<behavior name="netTcpNotificationServiceBehavior">
<serviceMetadata httpGetEnabled="true"
httpGetUrl="net.tcp://localhost:8011/CompanyName/Notification"/>
</behavior>
</serviceBehaviors>
</behaviors>
Run Code Online (Sandbox Code Playgroud)
这是客户端App.config:
<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="NetTcpBinding_IRegistrationService">
<security mode="None">
<message clientCredentialType="None"/>
<transport clientCredentialType="None"/>
</security>
</binding>
<binding name="NetTcpBinding_INotificationService">
<security …Run Code Online (Sandbox Code Playgroud) 我目前正在撰写一个与Facebook交互并为用户创建活动的网站.我正在使用Javascript提交事件,该事件已成功提交.问题是,Facebook上显示的时间与我提交的时间相差无几.
这是我的代码:
var event = {
start_time: '{{ show_time.start_time|date:'U' }}',
name: 'Movie Night: ' + '{{ show_time.movie.title }}'
};
FB.api('/me/events', 'post', event, function(response) {
// Send invites, etc...
});
Run Code Online (Sandbox Code Playgroud)
是的,我们在那里使用了一些Django.
{{show_time.start_time | date:'U'}}将放入一个纪元时间戳.我还发送了一个ISO 8601日期时间,结果相同.目前,我们在日期时间内没有时区信息.我不确定这是否会导致问题,因为要测试,我已经将-06:00添加到start_time,并且它仍然在Facebook上显示错误.
让我感到困惑的是Facebook上的文档中,它们显示了一条可能会创建事件的卷曲线,并且它们发送的start_time是一个纪元时间戳.在同一页面的其他部分,他们说start_time必须是ISO 8601.我还读过你需要将你的日期时间转换为太平洋时间,然后转换为纪元时间戳,然后将其作为start_time提交.我只是想知道正确的方法是什么.Facebook的文档在这方面看起来很糟糕,所以我希望SO能提供帮助!谁通过Javascript API实际上通过Facebook创建了一个活动,并让它显示在网站上的正确时间?你是怎么做到的?
我以前从未处理过PCI合规问题.我一直在阅读他们的文件,它说我需要保护信用卡号码,有效期和持卡人的姓名.无需存储安全代码.
在他们的文档中,它只是说保护.这是说我需要在我的数据库中加密这3列吗?我以为只有数字是需要加密的数据.无论哪种方式,我很好.
如果我需要加密所有三列,我是否共享一个证书并拥有3个对称密钥,或者我只需要1个,并且所有3列都使用该对称密钥?我问的原因是在加密列的BoL文档中,密钥是在加密列之后专门命名的.
感谢您的帮助!
asp按钮onclick事件未触发,按钮(id ="submit")有一个onclick事件(Submit_Click),在点击时不触发.为什么???
<form enctype="multipart/form-data" method="post" action="javascript:;">
<div class="content">
<p>
I am a returning customer</p>
<b>E-Mail Address:</b><br />
<asp:TextBox name="email" runat="server" ID="email"></asp:TextBox>
<asp:RegularExpressionValidator ID="email_validation" runat="server"
ControlToValidate="email" ErrorMessage="enter a valid email" ForeColor="Red"
ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
ValidationGroup="email"></asp:RegularExpressionValidator>
<br />
<br />
<b>Password:</b><br />
<asp:TextBox runat="server" name="password" TextMode="Password"></asp:TextBox>
<br />
<a href="javascript:;">Forgotten Password</a><br />
<br />
<asp:Button ID="Submit" runat="server" CssClass="button" Text="Login"
onclick="Submit_Click" />
<input type="hidden" value="http://www.przemyslawlobodzinski.pl/themes/megastore/index.php?route=account/account"
name="redirect"/>
</div>
</form>
Run Code Online (Sandbox Code Playgroud) c# ×2
android ×1
asp.net ×1
duplex ×1
encryption ×1
facebook ×1
javascript ×1
json ×1
pci-dss ×1
razor ×1
wcf ×1
web-services ×1