RegexRedirectRule Constructor (String, String, RegexOptions, Boolean)

HttpServer.dll

Initializes a new instance of the RegexRedirectRule class.

Namespace:  HttpServer.Rules
Assembly:  HttpServer (in HttpServer.dll) Version: 1.0.0.0 (1.0.0.0)

Syntax

C#
public RegexRedirectRule(
	string fromUrlExpression,
	string toUrlExpression,
	RegexOptions options,
	bool shouldRedirect
)
Visual Basic (Declaration)
Public Sub New ( _
	fromUrlExpression As String, _
	toUrlExpression As String, _
	options As RegexOptions, _
	shouldRedirect As Boolean _
)
Visual C++
public:
RegexRedirectRule(
	String^ fromUrlExpression, 
	String^ toUrlExpression, 
	RegexOptions options, 
	bool shouldRedirect
)

Parameters

fromUrlExpression
Type: System..::.String
Expression to match url
toUrlExpression
Type: System..::.String
Expression to generate url
options
Type: System.Text.RegularExpressions..::.RegexOptions
Regular expression options to apply
shouldRedirect
Type: System..::.Boolean
true if request should be redirected, false if the request uri should be replaced.

Examples

server.Add(new RegexRedirectRule("/(?<first>[a-zA-Z0-9]+)", "/user/${first}", RegexOptions.None)); Result of ie. /employee1 will then be /user/employee1

See Also