473,408 Members | 1,858 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Url Rewriting - some advice/help please!

hi all!

ok i'll try and keep this clean and simple

i have a web app where users can log in and manage a mini site (ie
galleries, files, news....)

and i have a web app which is the site where all that info they can
manage is displayed to the public

the way i'm handling it right now, is that for each user, i make a
copy of said public web app, and change the site_id value within the
web.config so that when you enter their url, the app knows what info
to get from the database

lately, i've been getting requests from my employer to find a way so
as to not have to copy the application for each one of our clients,
and try to see if we can implement url rewriting, where if you pass a
url

www.anyurl.com

the application can map that specific url to a site_id and load the
pertinent information

that way we only have one copy of our web application (in case we make
changes and rolling out those changes isn't such a hassle); instead of
N folders with the same web application, depending on the number of
clients we have
i hope i made myself clear
if anybody can please help me out here, to at least be directed in the
correct way to handle this situation

much appreciated

-cesar

Apr 3 '07 #1
6 1348
It's a bit confusing, because it "sounds" like you really want to use
something like host headers (e.g., clientname.yourdomain.com).

You certainly should *not* have to "copy" an entire site just to suit each
individual client.

Provided you've got a way to tell which client is requesting a page
(authentication)
then you can use this in combination with UrlRewriting to ensure that the
visitor gets to see what is intended for them to see.
Peter
--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"chanko" wrote:
hi all!

ok i'll try and keep this clean and simple

i have a web app where users can log in and manage a mini site (ie
galleries, files, news....)

and i have a web app which is the site where all that info they can
manage is displayed to the public

the way i'm handling it right now, is that for each user, i make a
copy of said public web app, and change the site_id value within the
web.config so that when you enter their url, the app knows what info
to get from the database

lately, i've been getting requests from my employer to find a way so
as to not have to copy the application for each one of our clients,
and try to see if we can implement url rewriting, where if you pass a
url

www.anyurl.com

the application can map that specific url to a site_id and load the
pertinent information

that way we only have one copy of our web application (in case we make
changes and rolling out those changes isn't such a hassle); instead of
N folders with the same web application, depending on the number of
clients we have
i hope i made myself clear
if anybody can please help me out here, to at least be directed in the
correct way to handle this situation

much appreciated

-cesar

Apr 3 '07 #2
On Apr 3, 8:14 pm, "chanko" <cha...@gmail.comwrote:
hi all!

ok i'll try and keep this clean and simple

i have a web app where users can log in and manage a mini site (ie
galleries, files, news....)

and i have a web app which is the site where all that info they can
manage is displayed to the public

the way i'm handling it right now, is that for each user, i make a
copy of said public web app, and change the site_id value within the
web.config so that when you enter their url, the app knows what info
to get from the database

lately, i've been getting requests from my employer to find a way so
as to not have to copy the application for each one of our clients,
and try to see if we can implement url rewriting, where if you pass a
url

www.anyurl.com

the application can map that specific url to a site_id and load the
pertinent information

that way we only have one copy of our web application (in case we make
changes and rolling out those changes isn't such a hassle); instead of
N folders with the same web application, depending on the number of
clients we have

i hope i made myself clear
if anybody can please help me out here, to at least be directed in the
correct way to handle this situation

much appreciated

-cesar
Using the Request.ServerVariables["HTTP_HOST"] you can get the name of
server. Pont all client domains to one website and check HTTP_HOST in
the code:

string host = Request.ServerVariables["HTTP_HOST"].ToLower();
int site_id;

if (host == "www.anyurl.com") {
site_id = 1;
}

....

Apr 3 '07 #3
On Apr 3, 11:26 am, Peter Bromberg [C# MVP]
<pbromb...@yahoo.yabbadabbadoo.comwrote:
It's a bit confusing, because it "sounds" like you really want to use
something like host headers (e.g., clientname.yourdomain.com).

You certainly should *not* have to "copy" an entire site just to suit each
individual client.

Provided you've got a way to tell which client is requesting a page
(authentication)
then you can use this in combination with UrlRewriting to ensure that the
visitor gets to see what is intended for them to see.
Peter
--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net

"chanko" wrote:
hi all!
ok i'll try and keep this clean and simple
i have a web app where users can log in and manage a mini site (ie
galleries, files, news....)
and i have a web app which is the site where all that info they can
manage is displayed to the public
the way i'm handling it right now, is that for each user, i make a
copy of said public web app, and change the site_id value within the
web.config so that when you enter their url, the app knows what info
to get from the database
lately, i've been getting requests from my employer to find a way so
as to not have to copy the application for each one of our clients,
and try to see if we can implement url rewriting, where if you pass a
url
www.anyurl.com
the application can map that specific url to a site_id and load the
pertinent information
that way we only have one copy of our web application (in case we make
changes and rolling out those changes isn't such a hassle); instead of
N folders with the same web application, depending on the number of
clients we have
i hope i made myself clear
if anybody can please help me out here, to at least be directed in the
correct way to handle this situation
much appreciated
-cesar- Hide quoted text -

- Show quoted text -
thanks for replying

i don't think i explained myself entirely

i have 2 applications at hand
- administration and
- public

one is the administration site, where a user can log on with their
credentials. with this i have no problem making a difference between
sites. but each user when logged on, can update info on their
"public" site
which is accessible to the whole world. sort of like google pages?
where i can log on and move everything around, but you can access my
page through my url chanko.googlepages.com

it's kind of like that
but in my case, each user or client normally wishes to user their own
url

www.client1.com
www.client2.net

and so forth

so if i have a web application that can render the site with a site
specific stylesheet and content, i wanted to see if i could just use
one single application and get the info from the url as to which site
you as a nonsuspecting internet navigator are trying to see

still pretty confusing? :S
i see alexey smirnov answered by accessing the
Request.ServerVariables["HTTP_HOST"].ToLower();
which i hadn't heard of, but in this case i imagine i would have to
make changes to code and recompile everytime i wanted to add a new
client/site?

thanks for responding!
i really appreciate it!

Apr 3 '07 #4
On Apr 3, 9:02 pm, "chanko" <cha...@gmail.comwrote:
which i hadn't heard of, but in this case i imagine i would have to
make changes to code and recompile everytime i wanted to add a new
client/site?
You can still use the web.config, e.g.

<SiteSettings>
<site_id>
<domainid>1</domainid>
<domain>www.client1.com</domain>
</site_id>
<site_id>
<domainid>2</domainid>
<domain>www.client2.net</domain>
</site_id>
</SiteSettings>

and get the settings out of it.

You can use a database. In this case you don't need to touch the
web.config

Apr 3 '07 #5
On Apr 3, 12:24 pm, "Alexey Smirnov" <alexey.smir...@gmail.comwrote:
On Apr 3, 9:02 pm, "chanko" <cha...@gmail.comwrote:
which i hadn't heard of, but in this case i imagine i would have to
make changes to code and recompile everytime i wanted to add a new
client/site?

You can still use the web.config, e.g.

<SiteSettings>
<site_id>
<domainid>1</domainid>
<domain>www.client1.com</domain>
</site_id>
<site_id>
<domainid>2</domainid>
<domain>www.client2.net</domain>
</site_id>
</SiteSettings>

and get the settings out of it.

You can use a database. In this case you don't need to touch the
web.config
so just on every page request, loop through all client/urls in
database and compare the value with
Request.ServerVariables["HTTP_HOST"]?

Apr 3 '07 #6
On Apr 3, 9:40 pm, "chanko" <cha...@gmail.comwrote:
so just on every page request, loop through all client/urls in
database and compare the value with
Request.ServerVariables["HTTP_HOST"]?
In the database you can query similar to the following:

SELECT site_id FROM clients WHERE http_host='anyurl.com'

Note, the HTTP_HOST returns anyurl.com for http://anyurl.com and
www.anyurl.com for http://www.anyurl.com (if you would have 2 host
headers per site: with www and without www)

Apr 3 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Jamie Jackson | last post by:
I'm rewriting all links' onclick events, but I'm having a problem. The onclick event that I'm inserting works correctly in Opera, but not in FF or IE. I'm retroactively adding the statement...
2
by: StaZ | last post by:
Hello, I would simply like to know if there's a way to disable the "feature" of MS Access that rewrites your queries "correctly"... This feature makes this : ...WHERE SomeBooleanField...;...
0
by: Netveloper | last post by:
Hi, I'm playing around with url rewriting and I have come across a problem which I can't seem to get past. The general ide is to have a IHttpHandlerFactory class which checks the incoming...
0
by: kellygreer1 | last post by:
Anyone else getting errors when using the URL Rewriting solution mentioned at the bottom of this article: http://www.codeproject.com/aspnet/urlrewriter.asp?df=100&forumid=4228&exp=0&select=876107 ...
3
by: Smokey Grindel | last post by:
I am using ASP.NET 2.0 and know about the static list in the web.config for URL rewriting, but my list is dynamic and I am running into some problems... 1) How do you get URL rewriting to work in...
3
by: Greg Collins [Microsoft MVP] | last post by:
I have done a bit of research of Url Rewriting, but as yet have been unsuccessful at getting it to work well, and there are issues around what file types are supported and how much code you want to...
8
by: rapiddata | last post by:
//reposting because of spelling mistake in "rewritting" in original post Is there a way to rewrite urls that have no extensions in the url, i.e. no ..aspx or no .html like...
0
by: Hamayun Khan | last post by:
Hi I m developing site for my client using asp.net 2.0. He asked me for URL rewriting. which I have done using Intelligencia.UrlRewriter.RewriterHttpModule rewriting module. I write the...
1
Shinobi
by: Shinobi | last post by:
I am using ASP.net(c#) for my project. In my my project 2 pages are using URL rewriting method by referring this article URL Rewriting using Intelligencia UrlRewriter Example 1 - Blog Day...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.