Groups | Blog | Home
all groups > dotnet faqs > december 2004 >

dotnet faqs : URL without suffix in .Net


Bharat Sharma
12/30/2004 6:28:23 PM
Just curious to know,

If there is a direcory named Product in the "/" folder then wht will
happen? How would IIS react to this?

[quoted text, click to view]

--

Best,
_____________
Bharat Sharma

* TEN Technologies.
* Official Web: _www.ten-technologies.com_
<http://www.ten-technologies.com/>
Victor Yuan
12/30/2004 6:53:20 PM
Is it implementable in .Net framework?
http://www.test.com/Product?id=7788

If so, How can I do that.

I know it can be done in J2EE environment.

Thanks!

Bharat Sharma
12/30/2004 7:43:17 PM
In that case you can take help of HTTP Handlers. They and some
coniguration setting in IIS can be of rescue for you.

this is my idea and have not worked into this i mean HTTP Handlers are
used to handle custom Extensions like "*.aaa"

But an extension less URI... I am not sure of how IIS is going to
respond to that because i "guess" any extensionless URI will result in
the interpretation as the directory's default File (it can be
configured in IIS). But lets say if some how via Custom HTTP Handler we
are able to implement it... then what will happen if there is a product
directory as well there. who will get the call?

I guess i need to put some more time on this... :) Meanwhile if you find
any solution, please let me know.

[quoted text, click to view]

--

Best,
_____________
Bharat Sharma

* TEN Technologies.
* Official Web: _www.ten-technologies.com_
<http://www.ten-technologies.com/>
Victor Yuan
12/30/2004 9:57:04 PM
Clarification:
We don't have a Product directory there.

Why we need such kind of URL?
We want to write a protocal via http, it should be platform
independent because we need to implement it in different platforms.

i.e. we can't design a protocal like this:
http://www.test.com/Product.aspx?id=7788
because it will be a weird implementation in J2EE platform.

Thanks.
Victor Yuen

"Bharat Sharma" <bharat@bharatsharma.net> ????
news:%23mNrZ9m7EHA.2124@TK2MSFTNGP14.phx.gbl...
Just curious to know,

If there is a direcory named Product in the "/" folder then wht will happen?
How would IIS react to this?

[quoted text, click to view]
Is it implementable in .Net framework?
http://www.test.com/Product?id=7788

If so, How can I do that.

I know it can be done in J2EE environment.

Thanks!





--

Best,
_____________
Bharat Sharma

TEN Technologies.
Official Web: www.ten-technologies.com
Personal Web: www.bharatsharma.net


Sylvain Lafontaine
12/31/2004 11:39:40 AM
The previous message is the solution to your problem and the « Product »
name for the repertory is just an exemple.

This notation will open the default file for the repertory /Product/
(something like www.test.com/Product/default.asp as an exemple) while
passing along the provided query string to this file.

S. L.

[quoted text, click to view]

Eric
1/2/2005 10:46:48 PM
[quoted text, click to view]

You need to research URL Rewriting. Here's one good example:
Dino Chiesa [Microsoft]
1/3/2005 4:50:34 PM
For more info on this topic, see

The IHttpHandler interface
http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemWebIHttpHandlerClassTopic.asp

URL Mapping in ASP.NET without extensions:
http://scottonwriting.net/sowblog/posts/943.aspx


--
To configure an HTTP Handler, you would specify something like this in the
web.config:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<httpHandlers>
<add verb="*" path="albums/*" validate="false"
type="nGallery.Lib.AlbumRequestHandler, nGalleryLib" />
</httpHandlers>

within the type="...", you specify the fully-qualified type name that
defines the IHttpHandler, and that type should be on the app's load path,
typically in the bin subdirectory.

Within that handler, you can do what you want. It is not restricted to URLs
that end in particular . The interface is simple, consisting of a single
method, ProcessRequest(), which feels something like the service() method of
the Java Servlet.

public void ProcessRequest(HttpContext context)
{
}

Now, for any request that arrives of the form
http://yourserver/albums/something/something ,
your handler gets called, and you decide what to do with the request:
handle it, rewrite the URL, forward the request, or do something else.
It's up to you. But the key is, your handler layers on ASP.NET, which in
turn depends on IIS. IIS needs to send the incoming request to ASP.NET
before your handler can be activated. By default, IIS sends only requests
with extensions like .aspx and .asmx to ASP.NET, so your handler won't get
activated, by default, for URLs that lack these extensions. In other words
you would need http://yourserver/albums/something/something.aspx . The
second link above discusses how to activate your IHttpHandler for "all
requests" of any extension, and also some of the pitfalls of that technique.


-Dino

Dino Chiesa [Microsoft]
1/4/2005 10:17:16 PM
I think the general solution requires an ISAPI filter, something like a
module for the Apache HTTP Server.
-Dino

[quoted text, click to view]

AddThis Social Bookmark Button