Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Http handlers, modules, or ISAPI?

Status
Not open for further replies.

robdog09

IS-IT--Management
Aug 23, 2005
19
US
I'm working on developing a new BLOG system for my employer, the University of Delaware. I want to provide bloggers with a URL thats easy to remember. I want to have each user have a url such as " instead of I hope you can understand why. When they access "/blogs/smithr", I want to intercept it and at that point I can easily parse out smithr and server.forward of response.redirect the client to the proper location.

The problem is that I can create a module or handler (either or) to intercept all requests. All I can do is have it intercept .aspx extensions, or some other custom extenstion. When I pass it in directory form like "/blogs/smithr", IIS automatically realizes that the smithr directory does not exists and throws a 404. W/o having to create a directory for each user in order for the request to get past IIS, how can I have it parse this?

Great examples are myspace ( webshots ( and furl ( All these have the directory-request format that I want.

ideas......
 
This will have to be set in IIS itself. Try asking in forum41 for more info.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Didn't even think of looking in the IIS forum. Thanks for the tip!
 
Oh, and you'll still have to make a httpHandler (or the method I've used before did), it's just that you'll have to configure IIS first so that the request is handled by .NET and you don't get the 404 error.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Ok, i have dissected IIS here and cannot find where that setting would be. Any ideas?
 
I can't remember off the top of my head so if you post in the IIS forum they will most likely be able to help you (plus your post may help other users who are searching for the same answer).


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
I actually have that code at home that will redirect to where you want it to go. Its called using a friendly name in the URL.
 
Ok great, can you post it when yuo get a chance? thanks
 
You go to the site's Properties->Virtual Directory tab->Configuration->Mappings (on XP anyway).

For Windows 2k and Win XP you need to map all extensions (.*) to the ASP.NET engine while with Win 2k3 I think you can choose to map just extensionless addresses if you want to.

This link will tell you everything you need to know including how to set up the IIS mappings:


Note, however, that there's a newer way to handle configuration than you'll see in the author's source code:


As a point of suggestion, I like having the URL rewriting code in .NET because it allows more flexibility. We wanted to create a URL rewriting provider to go beyond the RegEx replacement string method and we were able to do so since we had access to the code via an HttpModule.
 
Sweeeet...it worked.

What i did was did that for the entire application (your suggestion BoulderBum) then put a handler on the ~/ViewBlog directory for a path of "*", so anytime a request for ~/Viewblog/*/*/*/*..... occurs, the handler intercepts it. From there, i can split the request by "/" and work it backwards figuring out what blog to display

your the man...thanks again
 
one more thing,

you can also look into the 404 page not found page. this page can be customised. In this page you can get the path that was NOT found.

therefore if someone wrote this will redirect to your not found page. You can derive the URL there, then do some checking into the URL. if you feel it is correct then procede to redirect the correct page...

Known is handfull, Unknown is worldfull
 
Code:
Dim FriendlyName as String
FriendlyName = Server.URLEncode(Right(Request.QueryString,Len(Request.QueryString) - inStrRev(Request.QueryString,"/")))
Response.Redirect "/?myVal=" & myStr

Then do like I did, create a page called 404.aspx then set that web in IIS to point to that file for your error 404 page.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top