I have tried something like this
string path= Server.MapPath("~") + "color\";
But its throwing an error
“New line in constant”
Is there any way to append "\" in a string ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Use a verbatim string literal
or
\\The problem is that
\escapes the closing", that’s why this doesn’t work:However, you should really use the
Pathclass and it’s methods if you’re building paths as codingbiz has already mentioned in his answer. It will make your code more readable and less error-prone