Click here to Skip to main content
15,915,603 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi Friends,

Asp.net appln i'm using File.Exist(Path) it's local working fine when published in web server "File.Exist(path)" this maethod always return false (even if file exist) only....wt's the reason i dont't know anybody expert on this pls let me know asap it's very urgent coz published server is live server.


Advance Wishes!!!!!!ur rock!!!!!!
Ramesh Muthaiah
Posted
Comments
Sergey Alexandrovich Kryukov 21-Mar-12 1:15am    
Let me get it straight: the method is called on server side, so the file is also on the server side, right?
And path is the full path, right?
And the path is within the site's root directory, right?
--SA
Lakxman 21-Mar-12 1:15am    
Can you let me know how the 'Path' variable value is set? What does it point out? Please provide more information with code if possible.

Try checking it with
C#
Server.MapPath("your path here")


Have a look at this article here[^].

MSDN link[^]

Good luck,
OI
 
Share this answer
 
Try this.

string FilePath = Request.PhysicalApplicationPath + "FileName.txt"; 


Request.PhysicalApplicationPath will give you the virtual directory's absolute path.

For more info: http://asp-net-example.blogspot.in/2009/01/how-to-check-whether-file-exists-or-not.html[^]
 
Share this answer
 
Give Full permission to IIS USER it will help
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900