webcontrol with embedded javasript in assembly

M

md

Hello

I've created a webcontrol that uses some javascript. Currently i've embbed
the javascript into the assembly and it's added to the webpage if
necessary..

The disadvantage of this approach is that the client can't cache the script
because it's embedded into the page instead of referenced to an external
javascript file.

What's the best way to convert the embedded javascript into an external
javascript?

Thanks

Marco
 
L

lisa

md said:
Hello

I've created a webcontrol that uses some javascript. Currently i've embbed
the javascript into the assembly and it's added to the webpage if
necessary..

The disadvantage of this approach is that the client can't cache the script
because it's embedded into the page instead of referenced to an external
javascript file.

Is the caching that important?
What's the best way to convert the embedded javascript into an external
javascript?

A resource server. That works equally well for embedded images and
embedded files.

Lisa
 
M

MasterGaurav

Embedded the JS into assembly itself... yikes would be my first
response.

Now that you've already done it... you can add a handler for *.js files

Look for IHttpHandler or the topic "HTTP Runtime Support" in the docs
Look for "httpHandler element" index item in the docs.


--
Cheers,
Gaurav Vaish
http://mastergaurav.org
http://mastergaurav.blogspot.com
---------------------
 
M

MasterGaurav

Why would like to embed a static content?

It's more time + resource consuming to extract the code from the DLL.
You'd be using ResourceManager to load the JS dynamically.

"Dynamically" for static content is the reason for my "no to JS in
DLL".

Just have a JS file in a predefined directory. You may like to install
it in "aspnet_client/<your_dir>". For example:

- System.Web JS is in aspnet_client/system_web
- Infragistics puts its JS files in aspnet_client/infragistics


HTH.


--
Cheers,
Gaurav Vaish
http://mastergaurav.org
http://mastergaurav.blogspot.com
---------------------
 
R

recoil

No-Touch deployment would be the ultimate reason I would find this.
Eliminates the chore of distributing numerous files over repetitively.
Saves redundant tech support related to users inappropriately deploying
the component. Anybody that has to deploy 30-200 support files for an
extremely complex component versus dropping in an assembly that has
everything probably appreciates the benefit.
 
M

md

Correct! And that's why i was wondering if somebody already had developed
somehting that has "both worlds"..

Embed JS into Assembly for easy deployement and when used it should save the
JS file into the aspclient dir and have some checks to validate up-to-date
version..

Thanks

Marco
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,023
Latest member
websitedesig25

Latest Threads

Top