Why is my ASP.NET page injecting this WebResource.axd Javascript file?

前端 未结 5 1965
栀梦
栀梦 2021-01-01 02:45

When I view source on my ASP.NET page I get the following snippet:



        
5条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-01 03:01

    4 things to check:

    1. Are you using an UpdatePanel somewhere on the page?
    2. Do you have any javascript making calls to web methods in your code behind?
    3. Does your master page have anything in it that might be adding to your output?
    4. Are you referencing any controls from an external library?

    Once you've investigated that, you might be able to at least cut out some options as to the source of the problem.

    Can you provide any sample of the code on your ASPX?

    EDIT: Your post now includes a link to the source page. The page has a postback button on the form, which renders results of parsing without doing a full postback (notice that the whole screen doesn't reload). The webresource URL in your path contains the javascript functions used to accomplish this. Your code is doing a partial postback, which is why you have postback-related code on your page.

    EDIT #2: To completely remove postbacks from the system, you will need to remove the .NET form submission currently being used by your application. Your button is posting back, therefore it needs code to perform this postback to your server. If you want to remove this, you need to do things with old-school HTML posting straight to another URL. You will need a standard POST form with an action URL and form input fields. However, at that point, you are sort of defeating the purpose of using .NET and its postback support. I guess the final question is why do you need to remove this javascript?

提交回复
热议问题