Class Netrc
Represents data loaded from a .netrc file as a map from host names to credentials.
public sealed class Netrc : Dictionary<string, NetworkCredential>, IDictionary<string, NetworkCredential>, ICollection<KeyValuePair<string, NetworkCredential>>, IDictionary, ICollection, IReadOnlyDictionary<string, NetworkCredential>, IReadOnlyCollection<KeyValuePair<string, NetworkCredential>>, IEnumerable<KeyValuePair<string, NetworkCredential>>, IEnumerable, ISerializable, IDeserializationCallback
- Inheritance
-
objectNetrc
- Implements
- Inherited Members
- Extension Methods
Constructors
Netrc()
public Netrc()
Properties
DefaultPath
The default path for the .netrc file. Usually in the home directory. Can be overriden via NETRC environment variable.
public static string DefaultPath { get; }
Property Value
Methods
Load(string)
Loads credentials from a .netrc file.
public static Netrc Load(string path)
Parameters
pathstringThe path of the file to load.
Returns
Exceptions
- IOException
A problem occurred while loading the file.
- UnauthorizedAccessException
Read access to the file was denied.
LoadSafe()
Loads credentials from DefaultPath. Catches any exceptions and returns empty Netrc instead.
public static Netrc LoadSafe()