Why do I get the error message ‘The transport failed to connect to the server ‘
This is a network related error. Your application cannot connect to the mail server specified. Make sure that the following are true about SmtpMail.SmtpServer: Is a valid SMTP Server Make sure that the server System.Web.Mail is running or can connect to the mail server. Some times firewalls or proxy servers can get in the way. Try specifying the value by IP address. Poor DNS resolution can sometimes hinder name lookups. Make sure that the mail server is running at port 25. If you did not specify a SmtpMail.SmtpServer property, or if SmtpMail.SmtpServer points to ‘localhost’ (or the equivalent), be sure the SMTP Service is running on port 25. For testing purposes change the MailMessage.From and MailMessage.To properties to an address that exists on SmtpMail.SmtpServer. Some times this exception is thrown, when it really is a relay issue.
How can I cache the page by the complete querystring
Try the following: <%@ OutputCache Duration=’10’ VaryByParam=’*’ %> This should result in any changes to querystring parameters causing a new version of the page to be cached. Keep in mind that this can significantly increase the amount of memory used for caching, depending on how many querystring parameters you’re using. Note: ‘*’ is not recommended – it is best to use a list of params that your page truly varies by.
Is there any way to cache by browser a page or User Control
Try VaryByCustom=’browser’ in the user control/page.
How can I remove the cache of a page (cached with VaryByParam) for certain request params in code
You can attach a cache dependency to the response that is unique per query param, then invalidate the dependency for that particular param: // add cache item dependency on response string cacheKey = ‘xxx.aspx?’ + queryParam; Cache[cacheKey] = new object(); Response.AddCacheItemDependency(cacheKey); // invalidate the dependency string cacheKey = ‘xxx.aspx?’ + queryParam; Cache.Remove(cacheKey);
How can I set a page/control to be cached only for certain parameters
Let’s say you set your output cache directive as follows: <%@ OutputCache Duration=’86400′ VaryByParam=’RegionID’ VaryByCustom=’ProductID’ %> VaryByCustom – is a string that your application has to interpret in the GetVaryByCustomString override in the gloabal.asax file. Now, to avoid caching pages for certain ProductIDs you can set the cacheability to private or nocache from your page load for those pages as follows: VB.NET Response.Cache.SetCacheability(HttpCacheability.Private) C# Response.Cache.SetCacheability(HttpCacheability.Private) ;