Classic ASP: Multiple ASPSESSIONID in cookies

I was able to remove those cookies with Javascript. Just add next script to the end of login page. This will remove all “ASPSESSIONIDXXXXXXX” cookies before user will login to website: <script type=”text/javascript”> //Clear any session cookies (function(){ var cookiesArr = document.cookie.split(“; “); for (var i = 0; i < cookiesArr.length; i++) { var cItem … Read more

Can I serve .html files using Razor as if they were .cshtml files without changing the extension of all my pages?

Thank you to SLaks for pointing me in the right direction, but it still took a few hours of digging in the MVC source to figure out the solution. 1 – Need to put RazorBuildProvider in web.config <buildProviders> <add extension=”.html” type=”System.Web.WebPages.Razor.RazorBuildProvider”/> </buildProviders> And add System.Web.WebPages.Razor to assemblies if it isn’t already there. <assemblies> […] <add … Read more

Display custom error page when file upload exceeds allowed size in ASP.NET MVC

When running under IIS7 and upwards there is another parameter: <system.webServer> <security> <requestFiltering> <requestLimits maxAllowedContentLength=”10485760″ /> </requestFiltering> </security> </system.webServer> The default setting is slightly less than 30 MB. For uploaded files with size between maxRequestLength and maxAllowedContentLength IIS7 will throw an HttpException with HTTP code 500 and message text Maximum request length exceeded. When this … Read more

How to allow download of .json file with ASP.NET

If you want to manually add support to your site, you can just add the following to your web.config in the system.webServer section: <staticContent> <mimeMap fileExtension=”.json” mimeType=”application/json” /> </staticContent> This will add a “local” configuration under IIS. This does not work in IIS6, but does work in IIS7 and newer.

Mailbox unavailable. The server response was: 5.7.1 Unable to relay for [email protected] [closed]

Aahh got it… I got it working 🙂 Thanks Christopher, your suggesion is correct. But, finding “Default SMTP Virtual Server” was tricky 😉 Even if you use IIS7 to deploy your web site, you have to open IIS6 Manager to configure SMTP server (why?). I configured SMTP server as follows to make things work: Open … Read more

CustomErrors does not work when setting redirectMode=”ResponseRewrite”

It is important to note for anyone trying to do this in an MVC application that ResponseRewrite uses Server.Transfer behind the scenes. Therefore, the defaultRedirect must correspond to a legitimate file on the file system. Apparently, Server.Transfer is not compatible with MVC routes, therefore, if your error page is served by a controller action, Server.Transfer … Read more