Skip to content
+1-888-319-3663

COMMUNITY FORUM

WCF sample connection String ?

Adrian asked 6 years ago
I copied the code below from the from the SmartConnect manual .  I would like to try the command in Visual studio but the command is missing prentices and  “  causing syntax errors.
 
 System.Net.WebRequest request = System.Net.WebRequest.Create(“webservice.eonesolutions.request.Credentials = new System.Net.NetworkCredential(“username”,”password”,”domain”);
 
What is the correct Syntax?  Thanks
 
Patrick Roth Staff replied 6 years ago

I flipped in the online manual and don’t see code like you are trying to use above.
but the problem with the specific code you have above is exactly as you note.

remove the double quote after the .Create( statement since that isn’t a string.
And then you need to add a paren at the end because the .Create() method that you are calling doesn’t have its ending paren.

Answers
Lorren Zemke Staff answered 6 years ago
Adrian,
For that method to work, you need to replace the “username”, “password”, “domain” values with your actual variables or strings.
 
Here is Microsoft’s documentation on using the System.Net.WebRequest.Create method.
https://msdn.microsoft.com/en-us/library/bw00b1dc(v=vs.110).aspx
 
Adrian answered 6 years ago
Hello Lorren before I opened the case I replaced the values for username,password and domain.  I  received syntax error not and authentication error.  The C#  command string does not compile because of syntax issues not values.  
for instance 
Console.WriteLine(“password”);
Console.Writeline(“password”;    this line has a syntax error.
 
 

If you would like to submit an answer or comment, please sign in to the eOne portal.