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


protected void Page_Load(object sender, EventArgs e)


Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
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

Will you give this article a +1 ? Thanks in advance

About The Author

Suprotim Agarwal
Suprotim Agarwal, ASP.NET Architecture MVP (Microsoft Most Valuable Professional) 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 is the Editor of a Developer Magazine called DNC Magazine. He has also written two EBooks 51 Recipes using jQuery with ASP.NET Controls. and The Absolutely Awesome jQuery CookBook

Follow him on twitter @suprotimagarwal

No comments: