tsunami

log in
history
points to
ASP.NET Gotchas ~ ASP.NET Gotcha ASP.NET Gotcha
add add

ASP.NET Gotchas

Luke Breuer
2007-04-20 18:07 UTC

  • Static classes in ASP.NET are global. These means it is typically a BAD idea to store something like the HttpSession object in a static field.
  • Server.UrlDecode("+") == " ", which means Request.QueryString values will not contain these plus signs (unless perhaps they were encoded with %##).
  • Attributes quoted with single quotes will be converted to double quotes, escaping any double quotes in the attribute with """.
  • The "~/" in the src attribute is not rewritten by ASP.NET, but it is in the href attribute:
<script type="text/javascript" src="~/js/xmlhttprequest.js"></script>
<link type="text/css" rel="stylesheet" href="~/css/main.css" />
  • If Firefox is transmitting multiple cookies with the same name, see Rick Strahl's experiences, having to do with different domains for the cookie.
  • If one attempts to do textbox.Text = textbox.Text.Replace("<br />", "\r") when the textbox is in single-line mode, it will "eat" the carriage return (or newline), without throwing an exception. In other words, the above code is equivalent to textbox.Text = textbox.Text.Replace("<br />", ""). Frustrating!