Missing backslahes in filename using C#

Posted by CL4NCY on Stack Overflow See other posts from Stack Overflow or by CL4NCY
Published on 2010-03-25T18:11:04Z Indexed on 2010/03/25 18:13 UTC
Read the original article Hit count: 319

Filed under:
|

Hi,

I have a string literal as follows:

string filename = @"C:\myfolder\myfile.jpg";

When I use File.Exists(filename) it works most of the time but sometimes I get an error saying the following file doesn't exist:

C:myfoldermyfile.jpg

Something seems to strip the backslashes out of the filename. This code is sometimes accessed via an ajax request.

Does anyone know why/how this could be happening?

© Stack Overflow or respective owner

Related posts about c#

Related posts about string