我在这里看到了几个关于使用Recaptcha和ASP.net UpdatePanels的其他帖子,但还没有找到解决我的问题的答案.
这是我的ASPX代码:
<asp:UpdatePanel ID="updRecaptcha" runat="server" UpdateMode="Always">
<ContentTemplate>
<recaptcha:RecaptchaControl ID="btnrecaptcha" runat="server" Theme="clean" PrivateKey"<%$ Resources: General, CaptchaPrivateKey %>" PublicKey="<%$ Resources: General, CaptchaPublicKey %>" />
<asp:Label ID="recaptchaerror" runat="server" style="color: Red;"/>
</ContentTemplate>
</asp:UpdatePanel>
Run Code Online (Sandbox Code Playgroud)
因此,Recaptcha控件存在于使用多个.Net验证控件(例如RequiredFieldValidator)的用户控件中.在允许进程继续之前,我需要对Recaptcha和ASP.net控件进行验证.
如果任何验证失败(Recaptcha或.Net),则Recaptcha控件将消失.看一下HTML源代码,在Postback之后根本没有加载控件 - 尽管我告诉UpdatePanel要更新.
我无法完全重新加载页面,因为这一切都显示为页面顶部的叠加层,页面后面还有其他表单字段.
请帮忙!
编辑:
当Recaptcha失败时从C#我调用这段代码:
ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "InvalidRecaptcha", "alert('Recaptcha Failed');Recaptcha.reload();alert('Recaptcha Reloaded');", true);
Run Code Online (Sandbox Code Playgroud)
两个警报语句都会触发,但Recaptcha仍然无法加载.
我有两个通用列表,一个名为"精选",另一个名为"过滤".
List<Content> Featured = new List<Content>();
List<Content> Filtered = new List<Content>();
Run Code Online (Sandbox Code Playgroud)
两者都包含"内容"项,这些项是简单的类,如下所示:
public class Content
{
public long ContentID { get; set;}
public string Title { get; set; }
public string Url { get; set; }
public string Image { get; set; }
public string Teaser { get; set; }
public Content(long contentId, string title, string url, string image, string teaser)
{
ContentID = contentId;
Title = title;
Url = url;
Image = image;
}
}
Run Code Online (Sandbox Code Playgroud)
出现在"已过滤"但出现在"精选"中的所有项目都需要从"已过滤"中删除.此外,两个列表将合并为一个通用列表,首先显示"精选"项目.
我知道我可以写几个foreach循环来做这个但我不禁觉得必须有一个更优雅的方法使用LINQ.
我正在使用C#4.0.
我正在运行一个大型的ASP.net 4.0网站.它使用了流行的.Net内容管理系统,拥有数千个内容项,数百个并发用户 - 基本上是一个沉重的网站.
在1天的过程中,IIS7工作进程的内存使用量可以增加到8-10GB.服务器已安装16GB,目前设置为每天回收一次应用程序池.
我受到压力以减少内存使用量.大部分内存使用是由于缓存大量数据 - 但缓存间隔仅设置为5-10分钟 - 因此这些字符串最终应该从内存中过期.
但是在运行RedGate Memory Profiler之后,我可以看到我认为的内存泄漏.我已经通过"由Disposed Objects专门保存在内存中"的对象过滤了我的实例列表结果(我在RedGate论坛上看到这就是你发现内存泄漏的方法).这给了我一长串的内存字符串.
对于每个字符串,我使用实例保留图来查看内存中保存它的内容.System.string对象似乎在某些时候被System.Web.Caching.CacheDependency缓存了.如果我一直遵循图形,它会通过各种其他类,包括System.Collections.Specialized.ListDictionary,直到它到达System.Web.FileMonitor.这是有道理的,因为字符串是文件的路径(图像/ PDF /等).
似乎CMS正在缓存文件的路径,但这些缓存的对象随后被"泄露".随着时间的推移,这会增加并消耗RAM.
对不起,这是啰嗦......有没有办法阻止这些内存泄漏?或者在不诉诸回收应用程序池的情况下清除它们?我可以找到正在进行缓存的类/代码,看看我是否可以修复泄漏?
给出以下XML:
<platforms>
<platform>
<id>1</id>
<price>2.99</price>
</platform>
</platforms>
Run Code Online (Sandbox Code Playgroud)
如何根据值为"1"的子元素"id"选择"platform"元素作为XElement对象?
我到目前为止:
XDocument xPlatformXml = new XDocument();
XElement xel = xPlatformXml.Element("platforms").Elements("platform").Where(x => x.Value == "1").SingleOrDefault();
Run Code Online (Sandbox Code Playgroud)
但这是在"平台"元素而不是"id"中寻找价值.
我最近设置了TFS 2010,并尝试访问报告功能.TFS安装在Windows Server 2008 R2上,我使用Visual Studio 2010访问TFS.
根据我在网络上看到的内容,我应该在团队资源管理器中或在Visual Studio的"团队"菜单中有一个报告选项.我根本没有这个选项.我看过MSDN文章说这个选项旁边可能有一个红叉,但我根本看不到.
从TFS管理控制台,似乎已设置报告.所有三个选项(Warehouse,Analysis Services和Report Server)都有一个绿色勾号并说"已配置".
如果我访问报告URL,我会得到一个Web界面,但没有开箱即用的报告.
在此先感谢您的帮助.
我在VB.net中使用一个ASP.net网站项目,并向其中添加了LINQ到SQL数据类,以便使用许多LinqDataSource控件。昨天我的项目运行良好,但昨晚关闭并于今天早上启动后,我现在收到此错误:
编译错误描述:在编译为满足此请求所需的资源期间发生错误。请查看以下特定的错误详细信息,并适当地修改您的源代码。
编译器错误消息:BC30002:类型'System.Data.Linq.Mapping.DatabaseAttribute'未定义。
源错误:
<Global.System.Data.Linq.Mapping.DatabaseAttribute(Name:="xxxx_pcf")> _
Partial Public Class PCFDataContext
Inherits System.Data.Linq.DataContext
Run Code Online (Sandbox Code Playgroud)
该文件由Visual Studio 2010自动生成,但不会引发任何错误。我只在运行时得到错误。
互联网上的其他地方,人们建议删除命名空间声明,只有我没有。
我在这里还发现有人说System.Data.Linqweb.config文件中可能缺少对该引用的引用。不过,对我而言,我的web.config没问题。
同样在这里,有一个关于VS由于多元化原因重命名类的警告-再次对我无效。
所以我被困住了。
尝试运行我的Web服务WizardService.asmx时出现此错误:
System.MissingMethodException: No parameterless constructor defined for this object.
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache)
at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.Web.Services.Protocols.ServerProtocol.CreateServerInstance()
at System.Web.Services.Protocols.WebServiceHandler.Invoke()
at System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest()
Run Code Online (Sandbox Code Playgroud)
这是我在C#中的Web服务代码
[WebService(Namespace = "http://www.tempuri.com/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class WizardService : WebService
{
private EventLog eventLog;
private WizardService()
{
eventLog = new EventLog("EktronWizardServiceLog", "localhost", "EktronWizardService");
}
Run Code Online (Sandbox Code Playgroud)
我在网上看到的任何地方(包括这个网站)似乎都表明这个错误消息与MVC有关,但我没有使用MVC.这是一个ASMX .Net 4.5 Web服务.
我正在使用Google Maps v3,并且在地图上有一些标记,这些标记在单击时会显示一个InfoWindow。InfoWindow需要包含一个图像轮播。为了初始化轮播,我需要在InfoWindow打开后运行一些JavaScript。实际上,我需要InfoWindow.open()方法的回调。
但是我找不到一个,因此不得不使用setTimeout在初始化图像轮播之前等待1秒。这是不理想的。
有人知道更好的方法吗?
用完整代码更新
var widgetMap;
var widgetInfoWindow;
var widgetMarkers = [];
var popIndex = 0;
var popTotal = 0;
$(document).ready(function () {
$.ajax({
url: '/handlers/GoogleLocations.ashx?kmlpath=<%= KmlPath %>',
dataType: "json",
success: function (data) {
clearData();
initialize();
LoadWidgetMapData(data);
}
});
});
function initialize() {
var myLatlng = new google.maps.LatLng(53.32, -7.71);
var mapOptions = {
zoom: 7,
center: myLatlng
};
widgetMap = new google.maps.Map(document.getElementById('map-canvas'),
mapOptions);
widgetInfoWindow = new google.maps.InfoWindow();
widgetInfoWindow = new InfoBubble({
maxHeight: 275,
maxWidth: 350,
arrowSize: 30,
arrowStyle: …Run Code Online (Sandbox Code Playgroud) c# ×4
asp.net ×3
linq ×3
asmx ×1
google-maps ×1
linq-to-xml ×1
memory-leaks ×1
recaptcha ×1
redgate ×1
tfs ×1
tfs2010 ×1
updatepanel ×1
vb.net ×1
web-services ×1