473,508 Members | 2,292 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Set temporary folder for web application with impersonation as HttpRuntime.CodegenDir?

Hi all,

We have developed a web application in ASP .NET (C#, .NET 2.0, IIS 6.0,
Windows Server 2003), with integrated Windows authentification, and
impersonation. I have tried to use memory streams, as opposed to
temporary files, as often as possible beacuse we want to spare our
client the pain of folder rights administration.
But our efforts proved worthless as we integrated Crystal Reports
(VS2005 edition) in our application : their framework relies on the
creation of such temporary files, in C:\WINDOWS\Temp and in
....\ASPNET\Local Settings\Temp (%TMP%, Crystal not always running under
impersonation).
To keep our goal, we managed to find what appears to be a good
solution, but about which we would like to get some feedback. In
Global.asax, we set :

void Application_Start(object sender, EventArgs e)
{
string tmpPath=HttpRuntime.CodegenDir;
WebUtilities.SetEnvironmentVariable("TMP", tmpPath);
WebUtilities.SetEnvironmentVariable("TEMP", tmpPath);
}

SetEnvironmentVariable is defined as :

public static class WebUtilities
{
[DllImport("kernel32.dll", EntryPoint="SetEnvironmentVariableW",
CharSet=CharSet.Unicode)]
public static extern bool SetEnvironmentVariable(string name,
string val);
}

Everything works fine, as far as we could test. Do you think we can
rely on this ?

Thanks in advance.

Mathieu CARTOIXA
Nov 16 '07 #1
1 2978
Mathieu Cartoixa a écrit :
Hi all,

We have developed a web application in ASP .NET (C#, .NET 2.0, IIS
6.0, Windows Server 2003), with integrated Windows authentification, and
impersonation. I have tried to use memory streams, as opposed to
temporary files, as often as possible beacuse we want to spare our
client the pain of folder rights administration.
But our efforts proved worthless as we integrated Crystal Reports
(VS2005 edition) in our application : their framework relies on the
creation of such temporary files, in C:\WINDOWS\Temp and in
...\ASPNET\Local Settings\Temp (%TMP%, Crystal not always running under
impersonation).
To keep our goal, we managed to find what appears to be a good
solution, but about which we would like to get some feedback. In
Global.asax, we set :

void Application_Start(object sender, EventArgs e)
{
string tmpPath=HttpRuntime.CodegenDir;
WebUtilities.SetEnvironmentVariable("TMP", tmpPath);
WebUtilities.SetEnvironmentVariable("TEMP", tmpPath);
}

SetEnvironmentVariable is defined as :

public static class WebUtilities
{
[DllImport("kernel32.dll", EntryPoint="SetEnvironmentVariableW",
CharSet=CharSet.Unicode)]
public static extern bool SetEnvironmentVariable(string name, string
val);
}

Everything works fine, as far as we could test. Do you think we can
rely on this ?
OK, it seems that at some point you cannot avoid a bit of
administration when impersonating, even for this directory, cf.
http://msdn2.microsoft.com/en-us/library/kwzs111e.aspx

Mathieu CARTOIXA
Nov 22 '07 #2

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

Similar topics

2
3351
by: Rick Strahl [MVP] | last post by:
I'm having problems with installation of a Web app on my Win 2003 server. I copy up the app configure the virtual. But when I access any ASPX pages I now get: CS0016: Could not write to output...
12
5075
by: Chad Crowder | last post by:
Hi all, I hope someone can give me a hand, because I'm out of ideas. I keep getting this message: Access to the path "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET...
2
2887
by: Jon L. Lovesky | last post by:
Hello all, I am attempting to access a remote folder from an asp.net application (all within the same domain). The application is configured for windows authentication in IIS and the asp.net...
1
2711
by: James | last post by:
I am still having permission problems, but it has changed from a blanked 'Access Denied' error to this. I have ensured ASPNET user has 'full control' of the Temporary ASP.NET Files folder. ...
5
4429
by: Roy | last post by:
My dll file is copied to the "%windir%\Microsoft.NET\Framework\{version}Temporary ASP.NET Files" folder when I compile my asp.net project. When I run the application. The dll under this folder is...
5
3833
by: Bas Hendriks | last post by:
Has anyone any idea how asp.net find it's files back after compiling them to the temporary asp.net directory? I found on numerous webpages that the directorynames are chosen random but cannot find...
4
28938
by: Anbu | last post by:
Hi all, I have developed an application in VS .NET 2003 (framework 1.1) on a XP platform. It is working fine in that PC. Now, I setup new PC with same configuration for another develper....
2
2669
by: Chris Newby | last post by:
After googling this I got lots of information and tried a few different things. However pages for a particular site are still consistantly failing with "Access Denied to C:\ ... \Temporary Asp.Net...
1
1533
by: daniel.navarro.murillo | last post by:
Hi all, I'm using Process.Start() to execute an application which receives a file name as parameter. The file is stored into a network shared folder and I need to specify user and password to...
0
7224
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
1
7039
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
7494
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
5050
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
4706
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3180
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1553
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 ...
1
763
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
415
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.