Handling Postbacks if using ISAPI rewrite?

D

darrel

We're using ISAPI rewrite to turn this:

/district/2

into this actual URL

/default.aspx?siteID=2

Up to this point, things have been working perfectly, but we've never had to
do a postback, oddly enough. We're finally adding some functionality and
want to do some post back stuff.

The problems is that a postback keeps trying to reload this page:

/district/2/default.aspx?siteID=2

Which, of course, is non-existant.

I could add yet another rewrite rule to handle the odd postback URL, but is
there a more proper solution? Is there something I need to set up in my app
so postbacks actually load the proper page?

I've done a bit of googling and it sounds like the issue is simply a
Microsoft Bug. ARGH!

-Darrel
 
D

darrel

I've done a bit of googling and it sounds like the issue is simply a
Microsoft Bug. ARGH!

OK, through a LOT of googling, I found one possible solution. But I'm a bit
stumped on the instructions.

The answer is on this page, about 3/4 the way down:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/urlrewriting.asp

----------------------------------
namespace ActionlessForm {
public class Form : System.Web.UI.HtmlControls.HtmlForm
{
protected override void RenderAttributes(HtmlTextWriter writer)
{
writer.WriteAttribute("name", this.Name);
base.Attributes.Remove("name");

writer.WriteAttribute("method", this.Method);
base.Attributes.Remove("method");

this.Attributes.Render(writer);

base.Attributes.Remove("action");

if (base.ID != null)
writer.WriteAttribute("id", base.ClientID);
}
}
}

----------------------------------
I'm stuck on this:

"Once you have created this class and compiled it, to use it in an ASP.NET
Web application, start by adding it to the Web application's References
folder."

I assume I need to take the above, turn it into a DLL, and then reference it
from my VB application. How does one do that?

I tried making a new C# Class Library project, but VS.net didn't like the
'System.Web.UI.HtmlControls.HtmlForm' part and wouldn't let me compile.

-Darrel
 

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

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top