RequestCachePolicy::ToString Method ()

 

Returns a string representation of this instance.

Namespace:   System.Net.Cache
Assembly:  System (in System.dll)

public:
virtual String^ ToString() override

Return Value

Type: System::String^

A String containing the Level for this instance.

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;
}

.NET Framework
Available since 2.0
Return to top
Show: