WebControls and client script paths

Source: Internet
Author: User

There is not much useful information on the Internet, in an ebook excerpt the content as follows

650) this.width=650; "Src=" http://images2015.cnblogs.com/blog/441298/201612/441298-20161212083111104-433762712. PNG "style=" margin:0px;padding:0px;border:0px;width:618px; "/>

650) this.width=650; "Src=" http://images2015.cnblogs.com/blog/441298/201612/441298-20161212083111886-1268979578. PNG "style=" margin:0px;padding:0px;border:0px;width:618px; "/>

Webcontrols The configuration section has only one clientscriptslocation ASP.

<webcontrols clientscriptslocation= "/aspnet_client/{0}/{1}/"/>

<webcontrols>

ASP. NET 4 does not use this folder to store client script files. The client script file is actually embedded in the system.web assembly as a resource. and injected into the page via WebResource.axd HTTP handler.

You can use the Client script folder to save script files that are used by custom ASP.

> It feels like it's been abandoned, and in . NET framework4.6 requiredfieldvalidator

650) this.width=650; "Src=" http://images2015.cnblogs.com/blog/441298/201612/441298-20161212083112745-2126014803. PNG "style=" margin:0px;padding:0px;border:0px;width:618px; "/>

It can be concluded that the script file has been embedded in the assembly, through the WebResource.axd to obtain the corresponding resources. In fact, this can be embedded in the resources not only refers to JS, but also can be picture files.

I looked at it out of curiosity. RequiredFieldValidator 's code,

Found that there is a line of code is to register JS file in

650) this.width=650; "Src=" http://images2015.cnblogs.com/blog/441298/201612/441298-20161212083113354-1066215522. PNG "style=" margin:0px;padding:0px;border:0px;width:618px; "/>

So I tried it myself.

650) this.width=650; "Src=" http://images2015.cnblogs.com/blog/441298/201612/441298-20161212083113964-1216184227. PNG "style=" margin:0px;padding:0px;border:0px;width:618px; "/>

ClientScript is an example of ClientScriptManager, JS filename is js2.js, the previous need to set up the default namespace for this assembly here, the Js2.js file is placed in the site root directory.

650) this.width=650; "Src=" http://images2015.cnblogs.com/blog/441298/201612/441298-20161212083114573-731049998. PNG "style=" margin:0px;padding:0px;border:0px; "/>

file the properties of this setting are

650) this.width=650; "Src=" http://images2015.cnblogs.com/blog/441298/201612/441298-20161212083115276-1632564834. PNG "style=" margin:0px;padding:0px;border:0px; "/>

Run the page to see the generated HTML more than a JS reference

650) this.width=650; "Src=" http://images2015.cnblogs.com/blog/441298/201612/441298-20161212083116151-1153410737. PNG "style=" margin:0px;padding:0px;border:0px;width:618px; "/>

The question is why validatorbase inside the embedded JS do not need to use the namespace, MSDN example is also a well-added namespace. Is there another way to add a namespace to it?

But still a little unconvinced, look at the original aspnet_client how to get out, and later found through aspnet_regiis, can add aspnet_client. Try to really can add, but not much effect, at the beginning also guess will be configuration file WebControls configuration will affect the name of the generated folder, later found my guess wrong, or generate aspnet_client. It appears to be used in the. NET 1.0 version, and the subsequent versions are swapped with WebResource.axd. And now also with ASP. NET MVC, this belongs to use in the WebForm, now I still feel the JS put out not embedded in the assembly inside or inconvenient, modified JS and compiled code.


WebControls and client script paths

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.