我想在我的Web服务器上禁用分块传输编码,以避免此错误:http: //support.microsoft.com/kb/871205.不幸的是,我需要在Win2k上支持IE6,因此他们无法安装补丁.
我找到了将AspEnableChunkedEncoding设置为FALSE的说明,但这似乎并没有解决我的问题.我相信这是因为我们还使用gzip压缩,根据这篇文章(http://www.eggheadcafe.com/conversation.aspx?messageid=31045986&threadid=31045970),压缩编码需要压缩动态内容.因此,所有动态压缩的内容都被"分块"传输,因为它是由gzip过滤器压缩的,而不是ASP.NET.
我知道IIS可以无内容地提供这些内容,因为我尝试在请求中使用http 1.0(它不支持transfer-encoding:chunked),并且响应正确到达并压缩.
如何在使用ScriptManager时禁用分块编码,这需要动态压缩生成的".axd"文件?
iis gzip scriptmanager transfer-encoding internet-explorer-6
如果在Windows中启用"使用FIPS兼容算法进行加密,散列和签名"安全策略选项,则尝试在.NET Framework中使用许多加密类将导致InvalidOperationException.默认情况下,ASP.NET使用AES加密ViewState blob,因此失败.您可以通过向web.config添加这样的键来解决此问题:
<machineKey validationKey="AutoGenerate,IsolateApps" decryptionKey="AutoGenerate,IsolateApps" validation="3DES" decryption="3DES"/>
Run Code Online (Sandbox Code Playgroud)
这涵盖了ASP.NET的基本用法.我的问题是:我有一个庞大,复杂的ASP.NET Web应用程序,它大量使用ScriptManagers(ASP.NET AJAX的基础),需要由必须启用此FIPS策略设置的政府客户部署.任何带有ScriptManager的ASP.NET页面都会抛出此异常:
[InvalidOperationException: This implementation is not part of the Windows Platform FIPS validated cryptographic algorithms.]
System.Security.Cryptography.SHA1Managed..ctor() +3607454
System.Security.Policy.Hash.get_SHA1() +45
System.Web.Handlers.ScriptResourceHandler.GetAssemblyInfoInternal(Assembly assembly) +85
System.Web.Handlers.ScriptResourceHandler.GetAssemblyInfo(Assembly assembly) +99
System.Web.Handlers.RuntimeScriptResourceHandler.GetScriptResourceUrlImpl(List`1 assemblyResourceLists, Boolean zip, Boolean notifyScriptLoaded) +525
System.Web.Handlers.RuntimeScriptResourceHandler.System.Web.Handlers.IScriptResourceHandler.GetScriptResourceUrl(List`1 assemblyResourceLists, Boolean zip, Boolean notifyScriptLoaded) +910
System.Web.Handlers.RuntimeScriptResourceHandler.System.Web.Handlers.IScriptResourceHandler.GetScriptResourceUrl(Assembly assembly, String resourceName, CultureInfo culture, Boolean zip, Boolean notifyScriptLoaded) +193
System.Web.UI.ScriptReference.GetUrlFromName(ScriptManager scriptManager, IControl scriptManagerControl, Boolean zip) +306
System.Web.UI.ScriptManager.RegisterUniqueScripts(List`1 uniqueScripts) +169
System.Web.UI.ScriptManager.RegisterScripts() +407
System.Web.UI.ScriptManager.OnPagePreRenderComplete(Object sender, EventArgs e) +200
System.Web.UI.Page.OnPreRenderComplete(EventArgs e) +11041982 …Run Code Online (Sandbox Code Playgroud) 必须是一个简单的问题,但我不能为我的生活弄清楚如何在我的视图中包含脚本管理器.<asp:ScriptManager />不起作用.谁知道?
我目前正在使用System.Web.Extensions的CompositeScript功能,以便合并我的JavaScript文件以减少下载时间.但是,通过包含任何脚本管理器,我的页面中包含MicrosoftAjax JavaScript代码.我不希望这发生,因为它添加了许多不需要的代码,并且它使事件处理变得复杂.
我正在寻找以下之一:
我的母版页面上有一个脚本管理器.我需要一个或两个内容页面来删除webresourse.axd,因为它会导致页面上的其他JavaScript出现问题
如何在这些页面上禁用脚本管理器?
ScriptManager对象似乎没有任何看起来像他们会完成工作的属性
这可能吗?
How do I detect if a scriptmanager is loaded on a page? Some aspx pages have it and others don't and I need a user control to understand this so that it can either load it if needed and also for dealing with viewstate.
我有一个指定了ContentTemplate的UpdatePanel.页面加载时,用户可以在页面的其他部分进行一些AJAX工作.然后,在完成该工作之后,我想仅更新UpdatePanel内的内容,但不按任何按钮等.我应该在以前启动AJAX工作完成时使用JavaScript自动完成.如何在不手动点击触发按钮的情况下进行操作?
编辑:
好的,我已经遵循了_doPostBack规则,整个页面都已发布.
<asp:UpdatePanel ID="panelAttachments" runat="server">
<ContentTemplate>
........
</ContentTemplate>
</asp:UpdatePanel>
<input type="text" name="test" onchange="__doPostBack('<%=panelAttachments.UniqueID %>',''); return false;" />
</td>
Run Code Online (Sandbox Code Playgroud)
谢谢,Pawel
我想使用C#从User Control调用javascript函数.为此,我试图使用
ScriptManager.RegisterStartupScript(this, typeof(string), "alertbox", "javascript:ShowPopup('Select a row to rate');", true);
Run Code Online (Sandbox Code Playgroud)
但它不适合我.这在页面上工作正常.有人可以帮助我如何使用C#在运行时调用javascript函数.
谢谢,
嗨,我有一个aspx页面,其中我有以下代码
<asp:ScriptManager ID="scriptManager" runat="server" AsyncPostBackTimeout="500" EnablePageMethods="true">
</asp:ScriptManager>
<script type="text/javascript">
Sys.Application.add_init(BeginRequestHandler);
Sys.Application.add_init(EndRequestHandler);
Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(BeginRequestHandler);
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
function BeginRequestHandler(sender, args) {
AsynProcessing('block', 'AlertDiv', 'ProcessingImage');
}
function EndRequestHandler(sender, args) {
AsynProcessing('none', 'AlertDiv', '');
}
function AsynProcessing(visstring, elem, img) {
var adiv = $get(elem);
adiv.style.display = visstring;
adiv.image = img;
}
Run Code Online (Sandbox Code Playgroud)
但是该页面抛出了一个javascrip错误,因为'Sys.WebForms.PageRequestManager'为null或不是对象.我在scriptmanager标签下面放了.我甚至还说道
<xhtmlConformance mode="Transitional"/>
Run Code Online (Sandbox Code Playgroud)
在web.config.But部分仍然得到相同的错误.
任何帮助深表感谢.提前致谢
我使用了ScriptManager.RegisterStartupScript()方法,以便在后端发生特定事件时显示警报。它在页面加载方法中工作正常,但在单击特定按钮时调用的特定方法中不起作用。我找不到解决方案,因为在另一个页面中,它在页面加载和方法中都工作正常。
脚本管理器RegisterStartupScript方法
ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alert", "alert('msg');", true);
Run Code Online (Sandbox Code Playgroud)
超文本标记语言
<asp:HiddenField runat="server" ClientIDMode="Static" ID="PostBackController"/>
<button class="some-class" id="btnSave" runat="server" onclick="btnSave_clientClick();">SAVE</button>
Run Code Online (Sandbox Code Playgroud)
JavaScript
function btnSave_clientClick() {
// code
if (some_condition) {
$('#PostBackController').val("btn_save");
__doPostBack();
}
}
Run Code Online (Sandbox Code Playgroud)
页面加载方法
protected void Page_Load(object sender, EventArgs e)
{
if (PostBackController.Value == "btn_save")
{
uploadDocSave_ServerClick();
}
}
Run Code Online (Sandbox Code Playgroud)
单击按钮时应调用 Wish 方法
protected void uploadDocSave_ServerClick()
{
ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "alert", "alert('msg');", true);
}
Run Code Online (Sandbox Code Playgroud) scriptmanager ×10
asp.net ×8
asp.net-ajax ×2
c# ×2
javascript ×2
.net ×1
ajax ×1
asp.net-mvc ×1
fips ×1
gzip ×1
iis ×1
jquery ×1
razor ×1
updatepanel ×1