从ASP.NET 4.0中的网页中删除所有.axd文件 [英] Remove all .axd files from a webpage in ASP.NET 4.0

查看:100
本文介绍了从ASP.NET 4.0中的网页中删除所有.axd文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在我的网站中添加了Ajax ToolKit,但是由于页面上的繁重工作,我们希望删除Ajax Tool Kit.

I have added Ajax ToolKit in my website, but due to heavy load on the page we want to remove the Ajax Tool Kit.

要删除,我从bin文件夹中删除了文件,从工具"中删除了控制"选项卡.

To remove I deleted the file from the bin folder, Removed the control tab from Tools.

现在,当我运行网站时,我看到某些Webresource.axd吗?和Scriptresource.axd?项目中的脚本文件.

Now when I run the website, I see certain Webresource.axd? and Scriptresource.axd? script files in the project.

一个文件太重,大约55 KB,这会影响页面的加载时间.

One file is too heavy around 55 KBs which affects the load time of the page.

注意:我正在使用页面上的脚本管理器"和更新"面板,但是所有对Ajax ToolKit的引用都已删除.我的项目是使用4.0框架的.NET 2010网站.

Note: I am using Script Manager and update panel on the page, but all reference to Ajax ToolKit is removed. my project is a website in .NET 2010 using 4.0 framework.

推荐答案

要摆脱此类不必要的.axd文件,请使用Microsoft的Ajax.dll并为其编写自己的代码.使用Ajax的示例如下.

To get rid of such unnecessary .axd files use Ajax.dll from Microsoft and wirte your own code for it. example for using Ajax is as follows.

假设我在单击按钮时使用了多次删除功能,并且由于页面加载而我不想使用更新"面板,请尝试此操作.

Suppose i am using Multiple Delete function on button click and i dont want to use Update panel due to page load try this.

using Ajax;

在页面加载"事件上注册您的控件page_Load

Register your control on Page Load event page_Load

Ajax.Utility.RegisterTypeForAjax(typeof(Admin_UserControls_Delete));

方法

[Ajax.AjaxMethod()]
 public int deleteRecords(int ID,string spName)
 {
   // delete code block
 }


> In your **markup source on client click of button** call the javascript.

function callbackmethod(response) {
        if (response.value > 0) {
            alert("Record deleted Successfully");
            window.location.reload();
        }
        else {
            alert("Can Not Delete Record,It is being Used");
        }
}

function DeleteMultipleRecords() {

    //delete block to get the param values 
  var str = Admin_UserControls_Delete.deleteRecords(param1,param2,callbackmethod);
}

这篇关于从ASP.NET 4.0中的网页中删除所有.axd文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆