Class NetworkUtils
Utility functions for network information.
Inheritance
System.Object
NetworkUtils
Namespace: DotNetNuke.Common.Utils
Assembly: DotNetNuke.dll
Syntax
public class NetworkUtils : object
Methods
| Improve this Doc View SourceFormatAsCidr(String, String)
Formats as cidr.
Declaration
public static string FormatAsCidr(string startIP, string subnetMask)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | startIP | The start ip. |
| System.String | subnetMask | The subnet mask. |
Returns
| Type | Description |
|---|---|
| System.String | Classless Inter-Domain Routing. |
GetAddress(String, AddressType)
Gets the address.
Declaration
public static string GetAddress(string host, AddressType addressFormat)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | host | The host. |
| AddressType | addressFormat | The address format. |
Returns
| Type | Description |
|---|---|
| System.String | Returns IP address. |
See Also
| Improve this Doc View SourceGetClientIpAddress(HttpRequest)
Gets the Client IP address of the current request, from server variables if available, otherwise returns Request.UserHostAddress.
Declaration
public static string GetClientIpAddress(HttpRequest request)
Parameters
| Type | Name | Description |
|---|---|---|
| HttpRequest | request | The current http request. |
Returns
| Type | Description |
|---|---|
| System.String | The current client ip address. |
IP2Int(String)
Convert IP to Integer.
Declaration
public static uint IP2Int(string ipNumber)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | ipNumber | The ip number. |
Returns
| Type | Description |
|---|---|
| System.UInt32 | IP number as integer. |
IPtoLong(IPAddress)
Convert IP address to long integer.
Declaration
public static long IPtoLong(IPAddress ip)
Parameters
| Type | Name | Description |
|---|---|---|
| IPAddress | ip | The ip address. |
Returns
| Type | Description |
|---|---|
| System.Int64 | IP Address in long. |
IsIPInRange(String, String, String)
Determines whether ip is in range.
Declaration
public static bool IsIPInRange(string currentIP, string startIP, string subnetmask)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | currentIP | The current ip. |
| System.String | startIP | The start ip. |
| System.String | subnetmask | The subnet mask. |
Returns
| Type | Description |
|---|---|
| System.Boolean | True or False. |
LongToIp(Int64)
Longs to ip address.
Declaration
public static string LongToIp(long ip)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int64 | ip | The ip address. |
Returns
| Type | Description |
|---|---|
| System.String | IP Number as formatted string. |
Network2IpRange(String, out UInt32, out UInt32)
Network2s the ip range.
Declaration
public static void Network2IpRange(string sNetwork, out uint startIP, out uint endIP)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | sNetwork | The network name. |
| System.UInt32 | startIP | The start ip. |
| System.UInt32 | endIP | The end ip. |