• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1351
  • Last Modified:

Unrecognized escape sequence

Why doesnt this code work ?

string strDHLURL = "HTTPS:\\eCommerce.airborne.com";

I get this error "Unrecognized escape sequence"


Thanks,
Sean
0
sean-keys
Asked:
sean-keys
  • 2
1 Solution
 
jong3Commented:
The \ character is a escape character.

You will need to do one of the following...

1.  Change your string to:  "HTTPS:\\\\eCommerce.airborne.com";
or
2.  Add a @ symbol in front of the string:  @"HTTPS:\\eCommerce.airborne.com";


This should solve your problem.
0
 
sean-keysAuthor Commented:
Do both options do the exact same thing?  I'm new to c#.

0
 
jong3Commented:
Yes.  The @ simply tells the compiler to ignore any escape characters
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now