C# Class Headless.RelaxedFolderLocationValidator

The RelaxedFolderLocationValidator class uses relaxed rules for validating locations using Uri.GetComponents.
In addition to ignoring query strings and running case insensitive validations, this class also automatically appends trailing slashes to paths that appear to represent folders before running validation. This fixes validation issues where http://test.com/testing does not match http://test.com/testing/ where the server is likely to interpret the two as the same resource.
Inheritance: ComponentsLocationValidator
显示文件 Open project: roryprimrose/Headless

Public Methods

Method Description
Matches ( Uri location, Uri expectedLocation ) : bool This method appends a forward slash character to the path part of each Uri where the path appears to be a folder reference that lacks a trailing forward slash. This fixes validation issues where http://test.com/testing does not match http://test.com/testing/ where the server is likely to interpret the two as the same resource.
RelaxedFolderLocationValidator ( ) : System

Initializes a new instance of the RelaxedFolderLocationValidator class.

Private Methods

Method Description
MakeSafeFolderLocation ( Uri location ) : Uri

Makes the safe folder location.

Method Details

Matches() public method

This method appends a forward slash character to the path part of each Uri where the path appears to be a folder reference that lacks a trailing forward slash. This fixes validation issues where http://test.com/testing does not match http://test.com/testing/ where the server is likely to interpret the two as the same resource.
/// The parameter is null. /// /// The is a relative location where an absolute location is required. /// /// The parameter is null. /// /// The is a relative location where an absolute location is required. ///
public Matches ( Uri location, Uri expectedLocation ) : bool
location System.Uri
expectedLocation System.Uri
return bool

RelaxedFolderLocationValidator() public method

Initializes a new instance of the RelaxedFolderLocationValidator class.
public RelaxedFolderLocationValidator ( ) : System
return System