Daily Archives: 05/14/2009

ASP.NET accessing session variables in class modules

Sessions are a great way to share variable across your entire application, but they’re not accessable directly in class modules since they’re outside of page scope. So if you try something like Session(“VariableName”) = value  inside of your class, you will get an error.

Fortunately there is a way.  Thru HttpContext.Current notation available such common properties as Session, Server, Application, Cache. So to access your session variable inside a class just use HttpContext.Current.Session(“VariableName”) = value

Fixing WordPress 2.7 broken permalinks

When I moved this blog from former IIS to this Apache hosting I wanted to enable “pretty” permalink structure /year/month/day/topic, knowing that mod-rewrite was installed and active. But when I did that – every link resulted in 404 “Not Found” error. Trying to find solution I in WordPress support forums or even googling it was to no avail.
Finally I realised that when WordPress was enabling new link structure, for some reason it wasn’t writting rewrite rules into .htacess file. So, I put them there manually:

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . / [L]

And it worked.