0

I want to compile a code with codedom which should connect to my ftp server. But I cant type in the credentials because of the ""...

Look here :

Temp.AppendLine(@"request.Credentials = new NetworkCredential("userid","userpassword");");

If I type " in the code, it automatic ends the content of the brackets... Help?

GumGun
  • 15
  • 1
  • 1
  • 5

2 Answers2

1

You may need to escape the content by using double quotes, like this:

Temp.AppendLine(@"request.Credentials = new NetworkCredential(""userid"",""userpassword"");");
OnoSendai
  • 3,960
  • 2
  • 22
  • 46
  • Alright worked thank you! Maybe you know about CodeDom, I have also another question. How can I use the text of an TextBox in the code which I want to compile? I want to take the credentials from the textboxes of my form (the builder) :) – GumGun Jun 14 '13 at 15:12
  • You're welcome! Unfortunately my knowledge on CodeDom is limited; The answer to this question was actually depended only on C# string syntax. I suggest you open another question mentioning specifically that - how to capture the input from a CodeDom textbox. – OnoSendai Jun 14 '13 at 15:20
  • 1
    @GumGun If you have another question, *ask a new question*, don't use comments for that. – svick Jun 14 '13 at 15:32
1

Temp.AppendLine(@"request.Credentials = new NetworkCredential(""userid"",""userpassword"");");

Escape the " with ""

basher
  • 2,381
  • 1
  • 23
  • 34