Creating HttpHandlers

P

Prince

I have the following code within the ASP.NET project I
have created.

public class RedirectHandler : IHttpHandler{
//empty constructor
public void ProcessRequest(HttpContext context){
response.Redirect("page2.aspx");
}
public bool IsReusable(){
get {return false;}
}
}

then in the Web.config file, within the <System.web> I
have

<httpHandlers>
<add verb="*" path="*/xxx" type="RedirectHandler" />
</httpHandlers>

Basically, what I'm trying to do is, when a user enters,
www.xyz.com/xxx, I want the browser to redirect to
www.xyz.com/xxx.aspx. I don't mind if the user sees the
url in the address. There is no page named xxx. The
page is xxx.aspx but I don't want the person to HAVE to
enter the extension. They can but I don't want them to
HAVE to.

When I run the program, I get the following error.

Description: An error occurred during the processing of a
configuration file required to service this request.
Please review the specific error details below and modify
your configuration file appropriately.

Parser Error Message: Could not load type
DistributorRedirectHandler from assembly System.Web

It then highlights the <add verb="*" .....
line. Can anyone explain what this error message means
and how I can address it?

thanks,
Prince
 
P

Prince

It could also be a directory: For example, if you type
into your browser www.microsoft.com/developer it is
redirected to another page. I wish to do something as
simple as that since I don't have access to IIS. My
website is being hosted so I would like to accomplish the
same thing or something very similar.
 
C

clintonG

Google: "url rewriting" and variants as there are many articles
that document the objective.


--
<%= Clinton Gallagher
A/E/C Consulting, Web Design, e-Commerce Software Development
Wauwatosa, Milwaukee County, Wisconsin USA
NET csgallagher@ REMOVETHISTEXT metromilwaukee.com
URL http://www.metromilwaukee.com/clintongallagher/
 

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,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top