asp.net - IOException: The process cannot access the file 'filename' because it is being used by another process -
i have code in asp.net project:
protected void btnsave_click(object sender, eventargs e) { try { using (streamwriter sw = file.createtext(server.mappath(@"~/aboutus.txt"))) { sw.write(freetextbox1.text); sw.close(); sw.dispose(); lblerror.text = "تغییرات با موفقیت ذخیره شد."; lblerror.cssclass = "success"; } } catch (exception ex) { lblerror.text = "خطایی روی داده است!" + "\n" + ex.tostring(); lblerror.cssclass = "error"; } { lblerror.visible = true; } }
sometimes (not always) when hit btnsave
following error occurred:
ioexception: process cannot access file 'filename' because being used process
why?
you run application after see windows task manager-->processes, notepad.exe running right click click end process . .
Comments
Post a Comment