Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
platform
active.directory
adsi
adsi.iis-admin
base
com_ole
complus_mts
component_svcs
database
directx
gdi
graphics_mm
internet.client
internet.server
internet.server.isapi-dev
localization
mapi
messaging
msi
mslayerforunicode
multimedia
networking
networking.ipv6
sdk_install
security
shell
telephony.tapi_2
telephony.tapi_3
telephony.tsp
telephony.wte
tools
ui
ui_shell
win_base_svcs
win16
  
 
date: 24 Feb 2006 04:50:59 -0800,    group: microsoft.public.platformsdk.internet.server.isapi-dev        back       


Help please re: ISAPI DLL - URL rewrite scenario   
Well I've been working to build a URL rewriter for my situation using
httpContext.RewritePath in my C# web application, but I am having
problems... I think that the rewriting is happening way too late in the
page resolution chain of events, and now I'm starting to consider
better alternatives.  I am able to get my pages to resolve to the right
folder, however it only will recognize default.aspx pages and not
anything else like "about.htm".

I know that when using classic ASP, that using an ISAPI DLL utility was
the way to go, but I thought that .net 2.0 made it possible to do some
advanced things... maybe so, but I don't think it will work for what
I'm trying to do...

So let me explain my situation and see what anyone here might come up
with as a solution:

First off, I am building a community based website that will allow each
user to "own" their little area of the website themselves where they
can each have their own blogs, news, chat, html pages, etc... these
sorts of files will be stored into a traditional directory structure
like (root_folder_of_site/...../johnsmith/blog/default.aspx. (However,
I think that I may want to be able to do friendly URL rewriting in some
of these areas such that I won't have /blog/default.aspx?pageid=1234
but rather /blog/1234)... And I'll say upfront, YES, I do want to use
my "fake subdomain" method to access users content and NOT use
something like www.mysite.com/johnsmith/blog/blahblahblah as the URL to
access the files.  SO, THE ISAPI FILTER MUST ALLOW THE URL THATS
VISIBLE TO REMAIN ORIGINAL (ie johnsmith.mysite.com) WHILE IN THE
BACKGROUND REDIRECTING TO THE PROPER LOCATION.

I am using Microsofts DNS's "loosewildcarding" to allow for each of the
"users" to access their area via a "fake subdomain"... like this:
johnsmith.mysite.com or tedshomepage.mysite.com (mysite.com is the true
domain name, but the "johnsmith or tedshomepage" are not really
registered in DNS )... instead I have an entry for *.mysite.com that
allows all "unknown" unresolvable subdomains to be sent to a specific
IP (xx.225.0.26).

OK, here are a few more important tidbits:
In the DNS I have www.mysite.com and mysite.com setup with host (A)
records pointing to xx.225.0.25 and I also have *.mysite.com and
subdomains.mysite.com host records pointing to xx.225.0.26 ... The 0.25
IP is the base website for mysite.com which tells about news, events,
community calendar, etc... Also fyi the domain, subdomains.mysite.com,
is just a direct link to the "newsubdomain" folder as explained next...
it can be referenced directly via some site link to send people to the
default "signup" webpage that allows them to signup to have their own
area on mysite.com

My real directory structure looks like this:
c:\inetpub\otherwebs\mysite\newsubdomain AND also
c:\inetpub\otherwebs\mysite\custom_sites\johnsmith (note: \johnsmith
could just as well be anybody else)

In IIS (I'm running Windows 2000 Advanced Server with IIS5) I have
configured:

**one website that resolves www.mysite.com, mysite.com (using host
headers) as well as the raw IP xx.225.0.25 which as a whole points to
c:\inetpub\otherwebs\mysite ... remember, this is just the main website
portal

** one website that resolves subdomains.mysite.com (again using host
header) as well as the raw IP xx.225.0.26 which as a whole points to
c:\inetpub\otherwebs\mysite\newsubdomain... Lastly, this particular
website additionally has a virtual directory called custom_sites that
points to c:\inetpub\otherwebs\mysite\custom_sites.

Thus using loosewildcarding, I send all unknown/unresolvable domains to
this particular website (ala *.mysite.com) which has a virtual
directory to "custom_sites" for which /johnsmith can be found.

In other words, going to johnsmith.mysite.com resolves to the IP
xx.225.0.26 which has the subdirectory custom_sites which holds the
various users file heirarchies.  If a URL is entered that doesn't exist
in the custom_sites folder, then the URL re-writer will send them to
the root page (newsubdomain) where they will be solicited to use the
entered name as a new personal area... i.e. if Sandy.mysite.com is
entered in as a URL (but custom_sites/sandy doesn't exist on the box)
the user will goto the default signup webpage (AKA
subdomains.mysite.com) and be offered to create their own area called
sandy.mysite.com.

One additional piece of info... if by chance the user enters into an
existing customer area such as "/johnsmith" but they have a typo in the
url for the page's name like "/johnsmith/aboutme. thm" then the user
should be redirected to a custom 404 page that exist at
"/johnsmith/defaultpages/404error.aspx" and NOT at the mysite.com
default 404 page.

Phew... that was alot of explaining!  So I'm looking for an ISAPI URL
re-writer that will do a dynamic lookup to see if the fake subdomain
(ie. johnsmith.mysite.com) exist in the form of a folder called
"mysite\custom_sites\johnsmith"... if so, rewrite (or should I say
"map") that base address to that folder... therefore
johnsmith.mysite.com resolves to the correct root location... and of
course relative links on any of the pages in the /johnsmith folder need
to work as expected... for example a link in a file that resides at
mysite/custom_sites/johnsmith such as "<a href= '/aboutme.htm'>About
Me</a> will correctly resolve to
mysite/custom_sites/johnsmith/aboutme.htm.

That's as good as I can explain it.  Has anyone here done this before?
If so, do you mind sharing your solution?

I hope everyone understands what I've explained above.  I'm looking
forward to hearing from you all regarding this.
 
Thanks.
 
Kind Regards,
 
Mark Chipman
date: 24 Feb 2006 04:50:59 -0800   author:   unknown

Re: Help please re: ISAPI DLL - URL rewrite scenario   
- wildcard application mapping to aspnet_isapi.dll at the xx.225.0.26 
website. Make sure there are no other scriptmaps configured on the website 
that overrides this.
- HttpModule to rewrite Host header to vdir.
- HttpModule to do friendly URL rewrites ( /blog/default.aspx?pageid=1234 to 
/blog/1234 )
- Mysite.com Custom Error page that sends 302 redirection to 
"/johnsmith/defaultpages/404error.aspx" based on incoming 404 URL of 
"/johnsmith/about.thm"

You can do this with ISAPI Filter, ASP.Net, and even ISAPI Extension on 
IIS6. On IIS5, the wildcard application mapping requires all resources to be 
either ASP.Net content or static file download.

-- 
//David
IIS
http://blogs.msdn.com/David.Wang
This posting is provided "AS IS" with no warranties, and confers no rights.
//

 wrote in message 
news:1140785459.441010.159430@z34g2000cwc.googlegroups.com...
> Well I've been working to build a URL rewriter for my situation using
> httpContext.RewritePath in my C# web application, but I am having
> problems... I think that the rewriting is happening way too late in the
> page resolution chain of events, and now I'm starting to consider
> better alternatives.  I am able to get my pages to resolve to the right
> folder, however it only will recognize default.aspx pages and not
> anything else like "about.htm".
>
> I know that when using classic ASP, that using an ISAPI DLL utility was
> the way to go, but I thought that .net 2.0 made it possible to do some
> advanced things... maybe so, but I don't think it will work for what
> I'm trying to do...
>
> So let me explain my situation and see what anyone here might come up
> with as a solution:
>
> First off, I am building a community based website that will allow each
> user to "own" their little area of the website themselves where they
> can each have their own blogs, news, chat, html pages, etc... these
> sorts of files will be stored into a traditional directory structure
> like (root_folder_of_site/...../johnsmith/blog/default.aspx. (However,
> I think that I may want to be able to do friendly URL rewriting in some
> of these areas such that I won't have /blog/default.aspx?pageid=1234
> but rather /blog/1234)... And I'll say upfront, YES, I do want to use
> my "fake subdomain" method to access users content and NOT use
> something like www.mysite.com/johnsmith/blog/blahblahblah as the URL to
> access the files.  SO, THE ISAPI FILTER MUST ALLOW THE URL THATS
> VISIBLE TO REMAIN ORIGINAL (ie johnsmith.mysite.com) WHILE IN THE
> BACKGROUND REDIRECTING TO THE PROPER LOCATION.
>
> I am using Microsofts DNS's "loosewildcarding" to allow for each of the
> "users" to access their area via a "fake subdomain"... like this:
> johnsmith.mysite.com or tedshomepage.mysite.com (mysite.com is the true
> domain name, but the "johnsmith or tedshomepage" are not really
> registered in DNS )... instead I have an entry for *.mysite.com that
> allows all "unknown" unresolvable subdomains to be sent to a specific
> IP (xx.225.0.26).
>
> OK, here are a few more important tidbits:
> In the DNS I have www.mysite.com and mysite.com setup with host (A)
> records pointing to xx.225.0.25 and I also have *.mysite.com and
> subdomains.mysite.com host records pointing to xx.225.0.26 ... The 0.25
> IP is the base website for mysite.com which tells about news, events,
> community calendar, etc... Also fyi the domain, subdomains.mysite.com,
> is just a direct link to the "newsubdomain" folder as explained next...
> it can be referenced directly via some site link to send people to the
> default "signup" webpage that allows them to signup to have their own
> area on mysite.com
>
> My real directory structure looks like this:
> c:\inetpub\otherwebs\mysite\newsubdomain AND also
> c:\inetpub\otherwebs\mysite\custom_sites\johnsmith (note: \johnsmith
> could just as well be anybody else)
>
> In IIS (I'm running Windows 2000 Advanced Server with IIS5) I have
> configured:
>
> **one website that resolves www.mysite.com, mysite.com (using host
> headers) as well as the raw IP xx.225.0.25 which as a whole points to
> c:\inetpub\otherwebs\mysite ... remember, this is just the main website
> portal
>
> ** one website that resolves subdomains.mysite.com (again using host
> header) as well as the raw IP xx.225.0.26 which as a whole points to
> c:\inetpub\otherwebs\mysite\newsubdomain... Lastly, this particular
> website additionally has a virtual directory called custom_sites that
> points to c:\inetpub\otherwebs\mysite\custom_sites.
>
> Thus using loosewildcarding, I send all unknown/unresolvable domains to
> this particular website (ala *.mysite.com) which has a virtual
> directory to "custom_sites" for which /johnsmith can be found.
>
> In other words, going to johnsmith.mysite.com resolves to the IP
> xx.225.0.26 which has the subdirectory custom_sites which holds the
> various users file heirarchies.  If a URL is entered that doesn't exist
> in the custom_sites folder, then the URL re-writer will send them to
> the root page (newsubdomain) where they will be solicited to use the
> entered name as a new personal area... i.e. if Sandy.mysite.com is
> entered in as a URL (but custom_sites/sandy doesn't exist on the box)
> the user will goto the default signup webpage (AKA
> subdomains.mysite.com) and be offered to create their own area called
> sandy.mysite.com.
>
> One additional piece of info... if by chance the user enters into an
> existing customer area such as "/johnsmith" but they have a typo in the
> url for the page's name like "/johnsmith/aboutme. thm" then the user
> should be redirected to a custom 404 page that exist at
> "/johnsmith/defaultpages/404error.aspx" and NOT at the mysite.com
> default 404 page.
>
> Phew... that was alot of explaining!  So I'm looking for an ISAPI URL
> re-writer that will do a dynamic lookup to see if the fake subdomain
> (ie. johnsmith.mysite.com) exist in the form of a folder called
> "mysite\custom_sites\johnsmith"... if so, rewrite (or should I say
> "map") that base address to that folder... therefore
> johnsmith.mysite.com resolves to the correct root location... and of
> course relative links on any of the pages in the /johnsmith folder need
> to work as expected... for example a link in a file that resides at
> mysite/custom_sites/johnsmith such as "<a href= '/aboutme.htm'>About
> Me</a> will correctly resolve to
> mysite/custom_sites/johnsmith/aboutme.htm.
>
> That's as good as I can explain it.  Has anyone here done this before?
> If so, do you mind sharing your solution?
>
> I hope everyone understands what I've explained above.  I'm looking
> forward to hearing from you all regarding this.
>
> Thanks.
>
> Kind Regards,
>
> Mark Chipman
>
date: Sat, 25 Feb 2006 05:01:06 -0800   author:   David Wang [Msft]

Re: Help please re: ISAPI DLL - URL rewrite scenario   
Hello David:

Thanks for your reply...

After doing alot of looking for examples, I think that I'm wanting to
go the ISAPI filter route!  Given that, at what entry point (event)
would you recommend that I be entering the chain of events (ie
onURLMap, onPreprocHeaders or something else) so that the host name
remains unchanged (ie johnsmith.mysite.com) but at the same time the
application location could be remapped to
"c:\inetpub\otherwebs\mysite\custom_sites\johnsmith"?

I believe that if I choose the wrong entry point, then the host name
will also be remapped to "www.mysite.com/custom_sites/johnsmith" which
isn't what I desire... So, in other words, I want
"johnsmith.mysite.com/aboutme.htm" to resolve to
c:\inetpub\otherwebs\mysite\custom_sites\johnsmith\aboutme.htm".

David, I know that your busy, but I'd request if you wouldn't mind,
that you might write something up on your blog about this situation...
I'm sure that lots of others would be interested in reading about this
wildcarding/ISAPI approach!  I read your blog frequently.

I really really appreciate your assistance here!  I just can't believe
that I can't find ANY info on the net that directly addresses using
ISAPI filters in conjunction with loosewildcarding and URL mapping.

Thanks again.

Regards,

Mark Chipman
date: 25 Feb 2006 13:44:03 -0800   author:   unknown

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us