473,503 Members | 1,783 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Creating script files on demand during runtime..

I have script files embedded as resources in my dll. During runtime, I would
like to write it out into the app dir (or a app sub-dir) and send the
appropriate virtual path to the client. This makes deploying my dll much
easier - just a single dll, not having to worry about deploying script
files.

However, the runtime doesn't seem have enough permissions to write out to
the app dir (or any of it's subdir), by default. The folder where I will be
writing out needs to provide "Full Control" to "Everyone", for example, for
this to work. It's not very elegant any more.

Is there a workaround for this? I would like to write out my script files
some where dynamically and without the user having to provide permissions on
folders.

Thanks
Praveen
Nov 19 '05 #1
5 1895
How about using one of the user-specific system folders? MyDocuments,
Desktop, etc or even the user's temp folder should all be writeable under
the context of the useer running your dll.
"Praveen" <sf*********@online.nospam> wrote in message
news:Oj**************@TK2MSFTNGP12.phx.gbl...
I have script files embedded as resources in my dll. During runtime, I
would like to write it out into the app dir (or a app sub-dir) and send the
appropriate virtual path to the client. This makes deploying my dll much
easier - just a single dll, not having to worry about deploying script
files.

However, the runtime doesn't seem have enough permissions to write out to
the app dir (or any of it's subdir), by default. The folder where I will
be writing out needs to provide "Full Control" to "Everyone", for example,
for this to work. It's not very elegant any more.

Is there a workaround for this? I would like to write out my script files
some where dynamically and without the user having to provide permissions
on folders.

Thanks
Praveen

Nov 19 '05 #2
But then I cannot synthesize an appropriate URL for the script files (or the
image files) that the client can download, because it won't be within my app
dir - or any other virtual dir. Can I?

"Brian Lowe" <br********@ntlworld.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
How about using one of the user-specific system folders? MyDocuments,
Desktop, etc or even the user's temp folder should all be writeable under
the context of the useer running your dll.
"Praveen" <sf*********@online.nospam> wrote in message
news:Oj**************@TK2MSFTNGP12.phx.gbl...
I have script files embedded as resources in my dll. During runtime, I
would like to write it out into the app dir (or a app sub-dir) and send
the appropriate virtual path to the client. This makes deploying my dll
much easier - just a single dll, not having to worry about deploying
script files.

However, the runtime doesn't seem have enough permissions to write out to
the app dir (or any of it's subdir), by default. The folder where I will
be writing out needs to provide "Full Control" to "Everyone", for
example, for this to work. It's not very elegant any more.

Is there a workaround for this? I would like to write out my script files
some where dynamically and without the user having to provide permissions
on folders.

Thanks
Praveen


Nov 19 '05 #3
Hi Again Praveen,

As for the creating script files at runtime, if you do want to dynamically
create physical script files on your server's folder(maybe under your
application virtual dir's sub folder), you need to grant write permission
to your asp.net's process identity. But I don't think this is a good idea.
Alternatively, we can consider using a httphandler to render out script
resources (from resource assembly or other template files...).

Is it ok that your web appliation add an addiontal httphandler as global
script resource handler? Since httphandler can dynamically render out any
stream to clientside, we can let the httphandler to retrieve the script
resource from the assembly and write out to client. Then, in our asp.net
page, we can reference the script file through a url point to the
httphandler (with some querystring parameters to specify the assembly name
and resource file name).
For example:

<script
src="Http://servername/appname/scriptHandler.axd?asm=xxxx&filename=xxx" >
</script>

To make the url more sophisticated, we can encode or encrypte them. How do
you think of this?
Here is a tech article discussing on the similiar idea:

#Image Generation Service for ASP.NET 1.1
http://msdn.microsoft.com/msdnmag/is...e/default.aspx

Hope helps,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 19 '05 #4
Steven,

Thanks again for the feedback. That is a very good option. I alreay use such
a custom handler to generate images dynamically, I could extend it for this
scenario as well.

But (here I go), this would again require the user to setup the handler in a
web.config file (or machine.config file) during deployment and that breaks
the transparency. I do NOT want my user to know about these things I am
doing in the background. But, if I could register a httphandler in code -
from within my control implementation that would good. Is that possible?

Thanks
Praveen
"Steven Cheng[MSFT]" <v-******@online.microsoft.com> wrote in message
news:Gz****************@TK2MSFTNGXA02.phx.gbl...
Hi Again Praveen,

As for the creating script files at runtime, if you do want to dynamically
create physical script files on your server's folder(maybe under your
application virtual dir's sub folder), you need to grant write permission
to your asp.net's process identity. But I don't think this is a good
idea.
Alternatively, we can consider using a httphandler to render out script
resources (from resource assembly or other template files...).

Is it ok that your web appliation add an addiontal httphandler as global
script resource handler? Since httphandler can dynamically render out any
stream to clientside, we can let the httphandler to retrieve the script
resource from the assembly and write out to client. Then, in our asp.net
page, we can reference the script file through a url point to the
httphandler (with some querystring parameters to specify the assembly name
and resource file name).
For example:

<script
src="Http://servername/appname/scriptHandler.axd?asm=xxxx&filename=xxx" >
</script>

To make the url more sophisticated, we can encode or encrypte them. How
do
you think of this?
Here is a tech article discussing on the similiar idea:

#Image Generation Service for ASP.NET 1.1
http://msdn.microsoft.com/msdnmag/is...e/default.aspx

Hope helps,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)


Nov 19 '05 #5
Hi Praveen,

Yes, you're right. Using HttpHandler will certainly require the deploy
server to install the httphandler( configure in IIS and application config
file). Also, there hasn't any means to dynamically register httphandler at
runtime. So generally, when our custom webcontrol will need to expose some
external resource files such as script files images, we could:
1. put them into some global resource folders in IIS. For example, the IE
Webcontrol and ASP.NET buildin control put the global script files under
the root folder of the IIS site.

2.Using httphandler or aspx page to dynamically render out resources
streams.

Both of them will need preconfiguration before runtime execution since the
runtime applicaiton's execution identity has restricted permissions.

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 19 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2993
by: Newbie | last post by:
hi! i am able to upload files successfully. but i have one minor problem. files are uploaded correctly if the directory exists, it is throwing an exception if the directory doesnt exist. but the...
12
3138
by: Mats Lycken | last post by:
Hi, I'm creating a CMS that I would like to be plug-in based with different plugins handling different kinds of content. What I really want is to be able to load/unload plugins on the fly without...
5
3481
by: Sam777 | last post by:
I was under the impression that creating the app_offline.htm file at the root of the webapp would cause all handles to be closed so that the app could be removed. Unfortunately, this isn't the...
7
2285
by: Nathan Sokalski | last post by:
I am having a problem saving an image with the same name it originally had. I have two similar versions of my code, one in which I close the FileStream used to open the original image before saving,...
5
2486
by: batham | last post by:
Hi Gurus, How can I execute a script during runtime. Here is my code, so how do I execute the new script during runtime which should be a part of the 'topDiv'. Thanks Help is appreciated. -...
7
3668
by: =?Utf-8?B?bGZjZG0=?= | last post by:
Hi, I'm facing an issue and your help could be very helpful. In few words, I have a app build with VC++ 2005 SP1. I want to deploy it on a target machine, because the CRT dependency described...
15
5849
by: webstormcomputers | last post by:
I'm trying to update a hidden field with java script and I'm only getting one of the values from my select stament. Here is the code below. <select name="on0"> <option value="25">25 <option...
13
12771
by: jkimbler | last post by:
As part of our QA of hardware and firmware for the company I work for, we need to automate some testing of devices and firmware. Since not everybody here knows C#, I'm looking to create a new...
5
4451
by: DBC User | last post by:
I have a situation, where I need to add 4 or 5 data files (they change every time I build) in my project during build time and somehow I need a way to access these files during runtime. So I have...
0
7280
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7330
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6991
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7460
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5014
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3167
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3154
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1512
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
380
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.