问题
I have added Ajax ToolKit in my website, but due to heavy load on the page we want to remove the Ajax Tool Kit.
To remove I deleted the file from the bin folder, Removed the control tab from Tools.
Now when I run the website, I see certain Webresource.axd? and Scriptresource.axd? script files in the project.
One file is too heavy around 55 KBs which affects the load time of the page.
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.
回答1:
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;
Register your control on Page Load event page_Load
Ajax.Utility.RegisterTypeForAjax(typeof(Admin_UserControls_Delete));
method
[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);
}
来源:https://stackoverflow.com/questions/7564940/remove-all-axd-files-from-a-webpage-in-asp-net-4-0