我在MVC中使用淘汰赛.我试图将一个可观察的对象数组从敲除传递回我的MVC控制器动作以保存到数据库.如果我通过ko.toJSON(viewModel.ArrayName)将数组从knockout传递到我的控制器操作,它在我的控制器参数中返回null.如果我尝试通过ko.toJS(viewModel.ArrayName)将其传递给MVC,它具有正确的项目数,但由于某种原因数据为空.如何做到这一点的任何帮助将非常感激.谢谢!
我的JQuery数据检索方法:
var dataService = {};
var viewModel;
$(document).ready(function () {
dataService.getAccessLevelList();
})
dataService.getAccessLevelList = function () {
$.post('/DataService/GetAccessLevelList', null, function (data) {
viewModel = ko.mapping.fromJS(data);
ko.applyBindings(viewModel);
});
}
Run Code Online (Sandbox Code Playgroud)
这是问题方法:
updateAccessLevels = function () {
$.post('/DataService/UpdateAccessLevels', { accessLevels: ko.toJSON(viewModel.AccessLevels) }, function (status) {
alert(status);
});
}
Run Code Online (Sandbox Code Playgroud)
我的MVC控制器数据检索操作:
[HttpPost]
public ActionResult GetAccessLevelList()
{
FacilityAccessViewModel viewModel = new FacilityAccessViewModel();
viewModel.AccessLevels = unitOfWork.AccessLevelRepository.Get().ToList();
return Json(viewModel);
}
Run Code Online (Sandbox Code Playgroud)
尝试从此控制器方法的Knockout传入时,该参数返回NULL或NULL数据.
[HttpPost]
public ActionResult UpdateAccessLevels(List<AccessLevel> accessLevels)
{
try
{
foreach (AccessLevel record in accessLevels)
{
unitOfWork.AccessLevelRepository.Update(record);
} …Run Code Online (Sandbox Code Playgroud) 是否有可能替换Durandal 2.0中的默认路由器行为来替换默认路由,例如:'mysite.com/#/myroute'与'mysite.com/#!/myroute'的原因是为了谷歌蜘蛛检测页面是ajax爬行能力,我需要在url中插入一个hashbang而不仅仅是一个hashtag.任何帮助将不胜感激.
谢谢!
我是WCF的新手,但我在IIS中托管了一个WCF服务,它对我们的SQL Server有几个查询.我正在使用WPF应用程序使用WCF服务.我正在尝试做的是允许Windows身份验证从WPF客户端,到WCF服务,到SQL Server,以便SQL查询作为客户端用户执行.到目前为止,我一直试图以各种方式配置网站和主机,但没有运气.
在我的WCF服务网站上,我有匿名身份验证= true(对于MEX),ASP.NET Impersonation = true和Windows身份验证= true.
在我的WCF服务Web.config中:
<configuration>
<system.web>
<customErrors mode="Off"/>
<authentication mode="Windows"/>
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</assemblies>
</compilation>
</system.web>
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding maxReceivedMessageSize="5000000" name="WindowsSecurity">
<readerQuotas maxDepth="200"/>
<security mode="Transport">
<transport clientCredentialType="Windows" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<services>
<service name="ADATrackingService" behaviorConfiguration="ServiceBehavior">
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="WindowsSecurity"
name="wsHttpEndpoint" contract="IADATrackingService" />
<endpoint address="mex" binding="mexHttpsBinding" name="MexHttpsBindingEndpoint"
contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<serviceMetadata httpGetEnabled="false" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceAuthorization impersonateCallerForAllOperations="true" />
</behavior> …Run Code Online (Sandbox Code Playgroud) 我使用durandal 2.0编写了一个SPA,并使用HTML5 pushstate进行导航更改.我根据谷歌规格设置了一切.我不包括hashabangs /#!在我的网址中,我正在使用元碎片标记.
<meta name="fragment" content="!">
Run Code Online (Sandbox Code Playgroud)
我正在使用无头浏览器,幻影JS为谷歌机器人提供我的AJAX应用程序的完全呈现的HTML.在MVC中,我正在检测?_escaped_fragment_ =并执行302重定向到提供完全呈现的HTML的URL.该部分工作正常,测试,导航到这里:https://insureflo.com/? _ escaped_fragment_ =您将看到重定向,以及我的网站https://insureflo.com完全呈现的HTML内容.
我有一个站点地图,其中包含我的所有网址,包括根目录.尽管如此,谷歌仍然无法正确缓存或抓取我的应用程序,仍然显示应用程序的加载页面.我的印象是你可以使用pushstate并依赖于meta片段元标记来解析google,并自动在URL中包含escaped_fragment.
但是,在网站管理员工具中以googlebot格式获取以下响应:
HTTP/1.1 302 Found
Cache-Control: private
Content-Type: text/html; charset=utf-8
Location: /HtmlSnapshot?url=https%3A%2F%2Finsureflo.com%2F%23
Server: Microsoft-IIS/8.0
X-AspNetMvc-Version: 4.0
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Sun, 08 Sep 2013 06:59:28 GMT
Connection: close
Content-Length: 168
<html><head><title>Object moved</title></head><body>
<h2>Object moved to <a href="/HtmlSnapshot?url=https%3A%2F%2Finsureflo.com%2F%23">here</a>.</h2>
</body></html>
Run Code Online (Sandbox Code Playgroud)
这个302是正确的我相信根据规范,但为什么不索引重定向的内容并在HTMl视图和网站的图像预览中显示?此外,当在谷歌搜索结果中查看缓存时,我得到一个空白页面,并查看源呈现常规页面,而不是按预期完全呈现的HTML.例如:
http://webcache.googleusercontent.com/search?q=cache:https://insureflo.com
此时我已经阅读并阅读了规范,我相信我已经满足了爬行AJAX应用程序的要求,并且可以真正使用一些帮助来解决这个问题.我在这里错过了什么吗?谢谢!
javascript ×3
jquery ×3
ajax ×2
asp.net-mvc ×1
c# ×1
durandal ×1
html ×1
knockout.js ×1
seo ×1
silverlight ×1
wcf ×1
web-services ×1
wpf ×1