0

I am just starting to write a client(for me) for Dynamic DNS and have a problem

the client should be able to send something like this(their API) https://username:password@www.dnsdynamic.org/api/?hostname=techno.ns360.info&myip=127.0.0.1

so i write

string URI = @"https://User:1111111111@www.dnsdynamic.org/api/?
                                   hostname=MyHost.ns360.info&myip=127.0.0.1"
WebRequest req = WebRequest.Create(URI);

But i get Invalid Port Specified which makes me believe it is trying to send it on the 1111111 port of the password.

It works perfectly from the browser by the way

How can I fix this? Also is this even secure sending the password in the URL?

AngelicCore
  • 1,413
  • 3
  • 22
  • 40
  • 1
    Check out [this question/answer](http://stackoverflow.com/questions/8643746/create-a-httpwebrequest-for-a-http-userpassworddoamin-query-url), you need to use a `NetworkCredential`. The `WebRequest` is treating `1111111111` as a port, which is indeed invalid. – admdrew Dec 16 '13 at 22:15
  • 1
    `is this even secure sending the password in the URL?` No, it is generally considered to be a very bad practice in terms of security. – admdrew Dec 16 '13 at 22:18
  • `i get Invalid Port Specified`, But I get **no** error.... – L.B Dec 16 '13 at 22:48

0 Answers0