using System; using System.Net; class Program { static void Main(string[] args) { string username = "hello"; string password = "world"; NetworkCredential credential = new NetworkCredential(username, password); } }
using System; using System.Net; class Program { static void Main(string[] args) { string domain = "example.com"; string username = "hello"; string password = "world"; NetworkCredential credential = new NetworkCredential(username, password, domain); } }The System.Net.NetworkCredential class is part of the .NET Framework Class Library and can be found in the System.dll assembly.