gruber
gruber

Reputation: 29789

write file in the same path as c# file

Is it possible to write file to the same directory where the c# code that writes this file is ?

I mean something like there is c:\projects\myProject\test.cs

and when there is writeFile operation in test.cs

there is for example new file lest say test1.txt in c:\projects\myProject\test1.txt

I'm running asp.net application.

Upvotes: 0

Views: 259

Answers (2)

smohamed
smohamed

Reputation: 3314

I think you can also try Application.StartupPath

Upvotes: 0

SLaks
SLaks

Reputation: 888185

You're probably looking for Server.MapPath("~/Something.txt")

Upvotes: 4

Related Questions