DHTML Behaviors (HTC) in a custom server control

J

JV

I've coded a datagrid-derived control that makes use of a DHTML behavior in
a separate script file (.htc). Now that it works, I've realized that I
don't know how to deploy this well. I know how to embed the script in the
project as a resource, read it back and write it to a file, but obviously
the process under which this code would normally execute will not have the
right to do file I/O by default.

In all other controls I've coded, I just emitted embedded the script into
the page. Is there any way to do something like this with my HTC file or do
I have to start over and convert this behavior to a set of scripts?
 
R

recoil

You could possibly read it from the assembly as a resource and store it
in the cache. You could then setup a UrlRewrite for /Resources and have
it spit out the htc as a script from the cache. Of course realizing
that it would also have to handle the item not being in cache and thus
loading it.
 
J

JV

I've done something like that. I have implemented a custom HTTP handler to
respond to requests for HTC files and it spits them out from resource. The
problem is that you have to reconfigure IIS to support the HTC extension for
your application, and you have to modify your web.config. I can't expect
users of my controls to jump through those kind of hoops. It should be IJW
(it just works!) so they can just drop it on a form and start using it.

I've also tried streaming the scripts out to the web application folder at
design time, but in my control's OnInit function, I can't seem to do a
MapPathSecure() call to figure out where they need to be written. I can't
even use the path of the currently executing assembly because it's some
visual studio cache folder at design time.

Basically, there seems to be no solution that is of practical value....the
solution is apparently to wait for Whidbey to be released. Unless someone
has a more clever idea.
 

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,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top