Lets Have a fun with Technology.


Follow by Email

Monday, August 10, 2009

Delete Temporary File From ASP.Net

Hello Frd's

There are often required to delete temp file which created during asp.net pages hit.you can delete this temp files either mannualy or by coding.

to delete temp file using Coding follow the below Step.

Store Temp File Path in Session["pdfpath"]

Write below code in global.aspx

void Session_End(object sender, EventArgs e) {
if (System.IO.File.Exists(Session["pdfpath"].ToString()))System.IO.File.Delete(Session["pdfpath"].ToString()); }

in web.config
<sessionState mode="InProc" timeout="20">

this Code delete your temp file.

Please do not forgot to comment on articles.


Post a Comment