January 2, 2010

Programmatically determine the directory where ASP.NET stores temporary files




Today in the forums, I came across an interesting question. The user wanted to know if it was programmatically possible to determine where ASP.NET stored its temporary files.

The answer is yes and it’s done using the HttpRuntime.CodegenDir Property

C#

protected void Page_Load(object sender, EventArgs e)
{
Response.Write(HttpRuntime.CodegenDir);
}

VB.NET

Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
Response.Write(HttpRuntime.CodegenDir)
End Sub

Running this on my machine, I get the following output

C:\Users\Suprotim\AppData\Local\Temp\Temporary ASP.NET Files\SampleProjects\e2b93d07\cc8b1498



'Like' us on our FaceBook page if you find this blog useful. Thanks!


Did you like this post?
kick it on DotNetKicks.com Save on Delicious
subscribe via rss subscribe via e-mail
print this post follow me on twitter


About The Author

Suprotim Agarwal, ASP.NET Architecture MVP works as an Architect Consultant and provides consultancy on how to design and develop Web applications.

Suprotim is also the founder and primary contributor to DevCurry, DotNetCurry and SQLServerCurry. He has also written an EBook 51 Recipes using jQuery with ASP.NET Controls.

Follow him on twitter @suprotimagarwal

comments

0 Responses to "Programmatically determine the directory where ASP.NET stores temporary files"
 

Copyright © 2009-2012 All Rights Reserved for DevCurry.com by Suprotim Agarwal | Terms and Conditions