コード例 #1
0
bool CIISxpressHttpModule::GetAppPoolName(IHttpContext* pHttpContext, CAtlString& name)
{
	bool status = false;

	if (m_pHttpServer != NULL)
	{
		LPCWSTR pszAppPoolName = m_pHttpServer->GetAppPoolName();
		if (pszAppPoolName != NULL)
		{
			name = CAtlString(pszAppPoolName);
			status = true;
		}
	}

	// if we didn't get the application pool name from the server then at least try and fall back to the application id
	if (!status && pHttpContext != NULL)
	{
		IHttpApplication* pApp = pHttpContext->GetApplication();
		if (pApp != NULL)
		{
			PCWSTR pszAppId = pApp->GetApplicationId();
			if (pszAppId != NULL)
			{
				name = CAtlString(pszAppId);
				name.Replace('/', '_');
				status = true;
			}
		}
	}
	
	return status;
}
コード例 #2
0
   // typedef CStringT<TCHAR, StrTraitATL<TCHAR, ChTraitsCRT<TCHAR>>> CAtlString;

   CAtlString strBang(_T("Everybody likes epee fencing"));
   int n = strBang.Replace(_T("epee"), _T("foil"));
   ASSERT(n == 1);