Rant: Meaningless method (Request.QueryString.Add)?
This is really about the FormsAuthentication.RedirectFromLoginPage, which
redirect by default to default.aspx if this page was hit directly.
An intelligent choice, to assume everybody will have default.aspx as the
default return page, and thus hardcode the value. It wouldn't take too much
brainwork to foresee this need.
I was about to implement a clever hack to fix this. It appears that the
FormsAuthentication get its return page from the url in the returnURL key.
So I thought this would do the trick:
Needless to say it won't work. I get this error:
System.NotSupportedException: Collection is read-only.
The documentation says the QueryString property is a NameValueCollection
class, not a derivative of it. It says nowhere (where I can find) that the
Add method is overridden and disabled. So now I have 3 choices:
1. Rename file to default.aspx
2. Add a default.aspx with a Server.Transfer()
3. Or do a more dirty hack.
The last one has the biggest potential of destroying the authentication
code, the first one looks cleaner. But I hate I can't name my files what I
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center