Annoying HttpModule/QueryString Problem

A

Andreas Zita

What is the problem with this simple code? (implementing IHttpModule to
rewrite an incoming url-request)

private void context_BeginRequest(object sender, EventArgs e)
{
HttpApplication app = sender as HttpApplication;
try { System.Collections.Specialized.NameValueCollection test =
app.Request.QueryString; }
catch { }
app.Context.RewritePath("~/Library.aspx?token=Album&id=3");
}

The request returns 404 in Explorer.
When commenting out the try-statement it works, as well as when removing the
querystring part from the rewritepath value. But why???
What I want is to get the correct value for "id" and combine that with the
new rewritepath.
The inputpath is in the form: "~/Album.aspx" or "~/Album.aspx?id=3".

Please help me! This is insane!!!

/Andreas Zita
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,709
Latest member
AustinMudi

Latest Threads

Top