RequestCachePolicy.ToString Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Returns a string representation of this instance.
public:
override System::String ^ ToString();
public override string ToString ();
override this.ToString : unit -> string
Public Overrides Function ToString () As String
Returns
A String containing the Level for this instance.
Examples
The following code example creates a NoCacheNoStore policy and sends a request.
static WebResponse^ GetResponseFromServer( Uri^ uri )
{
RequestCachePolicy^ policy = gcnew RequestCachePolicy( RequestCacheLevel::NoCacheNoStore );
WebRequest^ request = WebRequest::Create( uri );
request->CachePolicy = policy;
WebResponse^ response = request->GetResponse();
Console::WriteLine( L"Policy is {0}.", policy );
Console::WriteLine( L"Is the response from the cache? {0}", response->IsFromCache );
return response;
}
public static WebResponse GetResponseFromServer(Uri uri)
{
RequestCachePolicy policy =
new RequestCachePolicy( RequestCacheLevel.NoCacheNoStore);
WebRequest request = WebRequest.Create(uri);
request.CachePolicy = policy;
WebResponse response = request.GetResponse();
Console.WriteLine("Policy is {0}.", policy.ToString());
Console.WriteLine("Is the response from the cache? {0}", response.IsFromCache);
return response;
}
Applies to
See also
Sodelujte z nami v storitvi GitHub
Vir za to vsebino najdete v storitvi GitHub, kjer lahko tudi ustvarite in pregledate težave in zahtevke za uveljavitev sprememb. Če želite več informacij, glejte naš vodnik za sodelavce.