I saw this in action via a control from Devmansion.com.
You add a control to the webform and supporting files are
automatically included in the project.
The *.js file is part of the project, and included as
contents. When the control is packaged, it will be in
the root directory of the library. I can reference the
file there.
I have also embedded the script itself in a resource file
and can read the contents of the .js into the .aspx at
runtime, but this increases the size of the page by a few
KB. I'd much rather have the control insert a <script>
tag with a src attrib, than the entire script itself.
I tried creating the file @ runtime and saving it in the
folder in the application root. If the folder doesn't
exist, then it creates that as well. If the file already
exists, then no action is taken. If by chance it gets
deleted, the control will detect that it is missing and
recreate the js file.
HOWEVER, to perform this action the ASP.NET worker
process needs to have write permissions on the directory,
and in the grand scheme of things, I think this could be
percieved as security issue.
-----Original Message-----
I have a custom web control that needs a javascript file
to be included as part of the project. I want to have
thecontrol automatically add the file in a specific folder
tothe project when the control is added to the designer.
I've been looking for some kind of designer class, but
can't find anything that will enable me to do what I
wantto do. Can anybody point me in the right direction?
Thanks!
.