| INT NormalizePath( |
| |
LPCTSTR lpszResource, |
|
| |
LPTSTR lpszNormalized, |
|
| |
INT nMaxLength |
|
| ); |
| INT NormalizePath( |
| |
LPCTSTR lpszResource, |
|
| |
CString& strNormalized |
|
| ); |
The NormalizePath method normalizes a resource on the
server returning a canonical path.
Parameters
- lpszResource
- A null-terminated string which specifies a
resource on the server. This parameter cannot be NULL.
- lpszNormalized
- A null-terminated string buffer which will contain the normalized
resource path when the method returns. The buffer must be large enough to
contain the entire path including the terminating null character. If
this parameter is NULL it will be ignored and the method will
return the length of the normalized path without copying any
characters. An alternate version of this method accepts a reference
to a CString object which will contain the normalized path
when the method returns.
- nMaxLength
- An integer value which specifies the maximum number of
characters which can be copied into the string buffer. If this value
is zero, the lpszNormalized parameter is ignored and the
method will return the length of the normalized path without
copying any characters.
Return Value
This method returns the number of characters copied into the
string buffer, not including the terminating null character. If the
lpszNormalized parameter is NULL, it will return the length
of the normalized path but will not copy any characters. If the
method fails, it will return HTTP_ERROR. To get extended error
information, call GetLastError.
Remarks
This method will accept a resource path on the server and
return a normalized version of that path. Normalization will
remove extraneous path delimiters and collapse the path if there
are references to parent directories. For example, if the resource
path provided is:
/text/..//project//./files/filename.pdf
This method would return the following as the normalized path:
/project/files/filename.pdf
The extraneous path delimiters are removed (the double slashes) and
the reference to the parent directory is collapsed to produce a simple,
uniform path. This can be useful both for display purposes and to
normalize input provided by a user. This method will accept an HTTP URL
and return only the normalized resource path for the URL. If you need
to normalize a complete URL, use the NormalizeUrl method.
Requirements
Minimum Desktop Platform: Windows 7 Service Pack 1
Minimum Server Platform: Windows Server 2008 R2 Service Pack 1
Header File: cstools12.h
Import Library: cshtpv12.lib
Unicode: Implemented as Unicode and ANSI versions
See Also
|