Where contact us is the name of that page stored ion a database.
I can easily use a ISAPI filter to change it to:
/page/78/contact-us
HOWEVER i do not want the "78" in the URL. The reason for this is that
site is already established under names like "/contact-us" as it was
done is .net somehow.
Anyway of doing this in ASP?
I had the idea of physically creating the folder "/contact-us" using
the FSO and thendropping in an index file which searched the database
for the ID based on the name of the page, then set a session based on
that ID and then did a server.transfer to the "mypage.asp" and changed
that page to look for the session rather than the querystring.
Just wondering if anyone has a neater way?
Regards and thanks for your time.
Dave.
Re: URL rewriting with ASP
am 29.07.2007 09:43:20 von Anthony Jones
"daddywhite" wrote in message
news:1185625418.416585.85130@22g2000hsm.googlegroups.com...
> I need to rewrite a URL like:
>
> FROM: /mypage.asp?my_id=78
>
> TO: /contact-us
>
> Where contact us is the name of that page stored ion a database.
>
> I can easily use a ISAPI filter to change it to:
>
> /page/78/contact-us
>
> HOWEVER i do not want the "78" in the URL. The reason for this is that
> site is already established under names like "/contact-us" as it was
> done is .net somehow.
>
> Anyway of doing this in ASP?
>
> I had the idea of physically creating the folder "/contact-us" using
> the FSO and thendropping in an index file which searched the database
> for the ID based on the name of the page, then set a session based on
> that ID and then did a server.transfer to the "mypage.asp" and changed
> that page to look for the session rather than the querystring.
>
> Just wondering if anyone has a neater way?
>
> Regards and thanks for your time.
>
Dave,
I'm finding it a little bit confusing to follow what effect you are really
after. It seems to be an unusual direction, normally one takes a
non-existant url such as /contact-us and re-writes it to a specific one like
/mypage.asp?my_id=78 for actual processing. What you seem to be asking for
is the other way round, is that correct?
You indicate that currently /contact-us doesn't physically exist. What do
you expect to happen when you attempt to re-write the URL to /custom-us?
If you need to pass on info to whatever processes the /custom-us URL such as
the user ID you can have your ISAPI filter add a custom header to the
request.
--
Anthony Jones - MVP ASP/ASP.NET
Re: URL rewriting with ASP
am 29.07.2007 11:02:39 von daddywhite
yes, "/contact-us" does not exist and I wish oit to re-write to the "/
mypage.asp?id=78"
The only way I have it done is using a ISAPI filter but that requires
that the id "78" or whatever is in the URL to be re-written
eg: "/78/contact-us"
HOWEVER i do not wish to have the "78" there - the reason for this is
that the website is already established and therefore the SEO links
are already looking at "/contact-us" - I want to keep this
functionality so as to not affect the SEO rankings. PLUS the client
wishes keep it this way.
The only way I have found is using custom 404 errors to extract the
"contact-us", look in the database for this title in order to find the
id of the page, then set a session equal to the ID then
server.transfer to the "mypage.asp"
This make sense?
Re: URL rewriting with ASP
am 29.07.2007 14:52:30 von toudidel
you can do it overwriting 404 http error
--
td
www.uddi.pl
Re: URL rewriting with ASP
am 29.07.2007 15:17:18 von daddywhite
anyone got a slightly more useful and indepth answer?
thanks in advance
regards
dave
Re: URL rewriting with ASP
am 29.07.2007 17:00:39 von Anthony Jones
"daddywhite" wrote in message
news:1185699759.109527.140350@q75g2000hsh.googlegroups.com.. .
> yes, "/contact-us" does not exist and I wish oit to re-write to the "/
> mypage.asp?id=78"
>
> The only way I have it done is using a ISAPI filter but that requires
> that the id "78" or whatever is in the URL to be re-written
>
> eg: "/78/contact-us"
>
> HOWEVER i do not wish to have the "78" there - the reason for this is
> that the website is already established and therefore the SEO links
> are already looking at "/contact-us" - I want to keep this
> functionality so as to not affect the SEO rankings. PLUS the client
> wishes keep it this way.
>
> The only way I have found is using custom 404 errors to extract the
> "contact-us", look in the database for this title in order to find the
> id of the page, then set a session equal to the ID then
> server.transfer to the "mypage.asp"
>
> This make sense?
>
It's getting closer but still a little muddy.
I take it that if the "78" in all this is some kind of user ID or some other
data which may vary.
In that case if you want the existing URL to remain simpy "/contact-us" then
where would the ID value be held? A cookie? Session variable? or something
else?
--
Anthony Jones - MVP ASP/ASP.NET
Re: URL rewriting with ASP
am 29.07.2007 18:01:22 von daddywhite
On 29 Jul, 16:00, "Anthony Jones" wrote:
> "daddywhite" wrote in message
>
> news:1185699759.109527.140350@q75g2000hsh.googlegroups.com.. .
>
>
>
>
>
> > yes, "/contact-us" does not exist and I wish oit to re-write to the "/
> > mypage.asp?id=78"
>
> > The only way I have it done is using a ISAPI filter but that requires
> > that the id "78" or whatever is in the URL to be re-written
>
> > eg: "/78/contact-us"
>
> > HOWEVER i do not wish to have the "78" there - the reason for this is
> > that the website is already established and therefore the SEO links
> > are already looking at "/contact-us" - I want to keep this
> > functionality so as to not affect the SEO rankings. PLUS the client
> > wishes keep it this way.
>
> > The only way I have found is using custom 404 errors to extract the
> > "contact-us", look in the database for this title in order to find the
> > id of the page, then set a session equal to the ID then
> > server.transfer to the "mypage.asp"
>
> > This make sense?
>
> It's getting closer but still a little muddy.
>
> I take it that if the "78" in all this is some kind of user ID or some other
> data which may vary.
>
> In that case if you want the existing URL to remain simpy "/contact-us" then
> where would the ID value be held? A cookie? Session variable? or something
> else?
>
> --
> Anthony Jones - MVP ASP/ASP.NET- Hide quoted text -
>
> - Show quoted text -
EXACLTY, that is the question I am asking. I assume a session
variable.
The 78 refers to the Id of the page held in the database.
I see lots of websites with /contact-us which are obviously database
driven - just wondering the best way to do this in ASP
see bbrail.com for example
Re: URL rewriting with ASP
am 29.07.2007 18:08:24 von reb01501
daddywhite wrote:
> On 29 Jul, 16:00, "Anthony Jones" wrote:
>> "daddywhite" wrote in message
>>
>> news:1185699759.109527.140350@q75g2000hsh.googlegroups.com.. .
>>
>>
>>
>>
>>
>>> yes, "/contact-us" does not exist and I wish oit to re-write to the
>>> "/ mypage.asp?id=78"
>>
>>> The only way I have it done is using a ISAPI filter but that
>>> requires that the id "78" or whatever is in the URL to be re-written
>>
>>> eg: "/78/contact-us"
>>
>>> HOWEVER i do not wish to have the "78" there - the reason for this
>>> is that the website is already established and therefore the SEO
>>> links
>>> are already looking at "/contact-us" - I want to keep this
>>> functionality so as to not affect the SEO rankings. PLUS the client
>>> wishes keep it this way.
>>
>>> The only way I have found is using custom 404 errors to extract the
>>> "contact-us", look in the database for this title in order to find
>>> the
>>> id of the page, then set a session equal to the ID then
>>> server.transfer to the "mypage.asp"
>>
>>> This make sense?
>>
>> It's getting closer but still a little muddy.
>>
>> I take it that if the "78" in all this is some kind of user ID or
>> some other data which may vary.
>>
>> In that case if you want the existing URL to remain simpy
>> "/contact-us" then where would the ID value be held? A cookie?
>> Session variable? or something else?
>>
>> --
>> Anthony Jones - MVP ASP/ASP.NET- Hide quoted text -
>>
>> - Show quoted text -
>
> EXACLTY, that is the question I am asking. I assume a session
> variable.
>
> The 78 refers to the Id of the page held in the database.
>
If the id is in a session variable, what is it doing in the url?
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Re: URL rewriting with ASP
am 29.07.2007 18:26:02 von Anthony Jones
"daddywhite" wrote in message
news:1185724882.939708.174100@g4g2000hsf.googlegroups.com...
> On 29 Jul, 16:00, "Anthony Jones" wrote:
> > "daddywhite" wrote in message
> >
> > news:1185699759.109527.140350@q75g2000hsh.googlegroups.com.. .
> >
> >
> > > yes, "/contact-us" does not exist and I wish oit to re-write to the "/
> > > mypage.asp?id=78"
> >
> > > The only way I have it done is using a ISAPI filter but that requires
> > > that the id "78" or whatever is in the URL to be re-written
> >
> > > eg: "/78/contact-us"
> >
> > > HOWEVER i do not wish to have the "78" there - the reason for this is
> > > that the website is already established and therefore the SEO links
> > > are already looking at "/contact-us" - I want to keep this
> > > functionality so as to not affect the SEO rankings. PLUS the client
> > > wishes keep it this way.
> >
> > > The only way I have found is using custom 404 errors to extract the
> > > "contact-us", look in the database for this title in order to find the
> > > id of the page, then set a session equal to the ID then
> > > server.transfer to the "mypage.asp"
> >
> > > This make sense?
> >
> > It's getting closer but still a little muddy.
> >
> > I take it that if the "78" in all this is some kind of user ID or some
other
> > data which may vary.
> >
> > In that case if you want the existing URL to remain simpy "/contact-us"
then
> > where would the ID value be held? A cookie? Session variable? or
something
> > else?
> >
> > --
> > Anthony Jones - MVP ASP/ASP.NET- Hide quoted text -
> >
> > - Show quoted text -
>
> EXACLTY, that is the question I am asking. I assume a session
> variable.
>
> The 78 refers to the Id of the page held in the database.
>
Ok still trying to demystify your requirement. I think your in a situation
where depending on the context of the current user session a visit to
/contact-us is expected to generate different results. An ID is to be
associated with the users session that specifies that content. I doubt I
have that right but in case I do:-
Store the ID in the Session object, use the 404 kludge, test that
/content-us is being requested, server.transfer to mypage.asp and have
mypage.asp retrieve the value its interested in from the session object.
Alternatively get the ISAPI filter to re-write the url to mypage.asp which
can still retrieve the ID from the session object.
--
Anthony Jones - MVP ASP/ASP.NET
Re: URL rewriting with ASP
am 29.07.2007 18:40:59 von daddywhite
On 29 Jul, 17:26, "Anthony Jones" wrote:
> "daddywhite" wrote in message
>
> news:1185724882.939708.174100@g4g2000hsf.googlegroups.com...
>
>
>
>
>
> > On 29 Jul, 16:00, "Anthony Jones" wrote:
> > > "daddywhite" wrote in message
>
> > >news:1185699759.109527.140350@q75g2000hsh.googlegroups.com. ..
>
> > > > yes, "/contact-us" does not exist and I wish oit to re-write to the "/
> > > > mypage.asp?id=78"
>
> > > > The only way I have it done is using a ISAPI filter but that requires
> > > > that the id "78" or whatever is in the URL to be re-written
>
> > > > eg: "/78/contact-us"
>
> > > > HOWEVER i do not wish to have the "78" there - the reason for this is
> > > > that the website is already established and therefore the SEO links
> > > > are already looking at "/contact-us" - I want to keep this
> > > > functionality so as to not affect the SEO rankings. PLUS the client
> > > > wishes keep it this way.
>
> > > > The only way I have found is using custom 404 errors to extract the
> > > > "contact-us", look in the database for this title in order to find the
> > > > id of the page, then set a session equal to the ID then
> > > > server.transfer to the "mypage.asp"
>
> > > > This make sense?
>
> > > It's getting closer but still a little muddy.
>
> > > I take it that if the "78" in all this is some kind of user ID or some
> other
> > > data which may vary.
>
> > > In that case if you want the existing URL to remain simpy "/contact-us"
> then
> > > where would the ID value be held? A cookie? Session variable? or
> something
> > > else?
>
> > > --
> > > Anthony Jones - MVP ASP/ASP.NET- Hide quoted text -
>
> > > - Show quoted text -
>
> > EXACLTY, that is the question I am asking. I assume a session
> > variable.
>
> > The 78 refers to the Id of the page held in the database.
>
> Ok still trying to demystify your requirement. I think your in a situation
> where depending on the context of the current user session a visit to
> /contact-us is expected to generate different results. An ID is to be
> associated with the users session that specifies that content. I doubt I
> have that right but in case I do:-
>
> Store the ID in the Session object, use the 404 kludge, test that
> /content-us is being requested, server.transfer to mypage.asp and have
> mypage.asp retrieve the value its interested in from the session object.
>
> Alternatively get the ISAPI filter to re-write the url to mypage.asp which
> can still retrieve the ID from the session object.
>
> --
> Anthony Jones - MVP ASP/ASP.NET- Hide quoted text -
>
> - Show quoted text -
Thanks for your reply
===============================
> Store the ID in the Session object, use the 404 kludge, test that
> /content-us is being requested, server.transfer to mypage.asp and have
> mypage.asp retrieve the value its interested in from the session object.
===============================
This is exactly what I thought I would need to do.
I was wondering whether there was any other way - I know about the
ISAPI filter method but that would require the ID being in the URL
somewhere.I DO NOT want this to happen.
One way I figured was:
1) "/contact-us"
2) ISAPI rewrites this to "mypage.asp" passing "contact-us" as a
querystring
3) "mypage.asp" looks in database for "contact-us" and then displayed
the relevant page content
4) alternatively on the "mypage.asp" if the querystring returns
"*.asp" then server.transfer to that ASP page. (cos not all of the
websites pages are dynamic database driven)
Does this make sense as to what I am tring to do?
Unless I can use the ISAPI filter to only kick in when ".asp" is NOT
found in the URL of course.
Apologies if I am/was not making sense - its quite hard to explain
what I am trying to acheive.
Re: URL rewriting with ASP
am 29.07.2007 18:59:01 von Anthony Jones
"daddywhite" wrote in message
news:1185727259.464427.244640@g4g2000hsf.googlegroups.com...
> On 29 Jul, 17:26, "Anthony Jones" wrote:
> > "daddywhite" wrote in message
> >
> > news:1185724882.939708.174100@g4g2000hsf.googlegroups.com...
> >
> >
> >
> >
> >
> > > On 29 Jul, 16:00, "Anthony Jones" wrote:
> > > > "daddywhite" wrote in message
> >
> > > >news:1185699759.109527.140350@q75g2000hsh.googlegroups.com. ..
> >
> > > > > yes, "/contact-us" does not exist and I wish oit to re-write to
the "/
> > > > > mypage.asp?id=78"
> >
> > > > > The only way I have it done is using a ISAPI filter but that
requires
> > > > > that the id "78" or whatever is in the URL to be re-written
> >
> > > > > eg: "/78/contact-us"
> >
> > > > > HOWEVER i do not wish to have the "78" there - the reason for this
is
> > > > > that the website is already established and therefore the SEO
links
> > > > > are already looking at "/contact-us" - I want to keep this
> > > > > functionality so as to not affect the SEO rankings. PLUS the
client
> > > > > wishes keep it this way.
> >
> > > > > The only way I have found is using custom 404 errors to extract
the
> > > > > "contact-us", look in the database for this title in order to find
the
> > > > > id of the page, then set a session equal to the ID then
> > > > > server.transfer to the "mypage.asp"
> >
> > > > > This make sense?
> >
> > > > It's getting closer but still a little muddy.
> >
> > > > I take it that if the "78" in all this is some kind of user ID or
some
> > other
> > > > data which may vary.
> >
> > > > In that case if you want the existing URL to remain simpy
"/contact-us"
> > then
> > > > where would the ID value be held? A cookie? Session variable? or
> > something
> > > > else?
> >
> > > > --
> > > > Anthony Jones - MVP ASP/ASP.NET- Hide quoted text -
> >
> > > > - Show quoted text -
> >
> > > EXACLTY, that is the question I am asking. I assume a session
> > > variable.
> >
> > > The 78 refers to the Id of the page held in the database.
> >
> > Ok still trying to demystify your requirement. I think your in a
situation
> > where depending on the context of the current user session a visit to
> > /contact-us is expected to generate different results. An ID is to be
> > associated with the users session that specifies that content. I doubt
I
> > have that right but in case I do:-
> >
> > Store the ID in the Session object, use the 404 kludge, test that
> > /content-us is being requested, server.transfer to mypage.asp and have
> > mypage.asp retrieve the value its interested in from the session object.
> >
> > Alternatively get the ISAPI filter to re-write the url to mypage.asp
which
> > can still retrieve the ID from the session object.
> >
> > --
> > Anthony Jones - MVP ASP/ASP.NET- Hide quoted text -
> >
> > - Show quoted text -
>
> Thanks for your reply
> ===============================
> > Store the ID in the Session object, use the 404 kludge, test that
> > /content-us is being requested, server.transfer to mypage.asp and have
> > mypage.asp retrieve the value its interested in from the session object.
> ===============================
>
> This is exactly what I thought I would need to do.
>
> I was wondering whether there was any other way - I know about the
> ISAPI filter method but that would require the ID being in the URL
> somewhere.I DO NOT want this to happen.
>
> One way I figured was:
>
> 1) "/contact-us"
> 2) ISAPI rewrites this to "mypage.asp" passing "contact-us" as a
> querystring
> 3) "mypage.asp" looks in database for "contact-us" and then displayed
> the relevant page content
> 4) alternatively on the "mypage.asp" if the querystring returns
> "*.asp" then server.transfer to that ASP page. (cos not all of the
> websites pages are dynamic database driven)
>
> Does this make sense as to what I am tring to do?
>
> Unless I can use the ISAPI filter to only kick in when ".asp" is NOT
> found in the URL of course.
>
> Apologies if I am/was not making sense - its quite hard to explain
> what I am trying to acheive.
>
What I think you want keeps changing. It isn't helping that your not
responding to statements I'm making that don't match what you want.
Now what I think you want is that there will be a number of different URLs
referenced in the system which don't actually exist and you want to trap
those in order to send the appropriate output. Again I still don't think
I've got it. But in case I have:-
It sounds like what you are looking for is the 404 trick. However instead
of the 404 custom handling page transfering to mypage.asp, the 404 custom
handler _IS_ mypage.asp. Now all the mypage.asp has to do is use the URL
(already provided in the querystring by IIS on encountering a 404) as a key
to lookup the content to be sent. This ditched the numeric ID altogether.
I would avoid writing an ISAPI filter unless it's absolutely necessary.
Are we getting there?
--
Anthony Jones - MVP ASP/ASP.NET
Re: URL rewriting with ASP
am 29.07.2007 22:31:12 von Rob Parsons
Hi Dave,
To hide the location.href values of documents that you present to the user,
you need to use frames for site navigation and not open documents in their
own window/tab.
Here are some snippets from my site
In my root folder, the start page is set to Index.asp, which can accepte an
optional parameter 'url'
<%@ Language="VBSCRIPT" %>
<%
dim sURL
sURL = Request.QueryString("URL")
if len(sURL)=0 then
sURL = "Welcome.asp"
end if
Session("CurrentPage")="Welcome.asp"
%>
----------------------------------------------
My Index page is a frames page with two frames
In each page I put the following script
This will test to see if the page has a parent (frame) as it is being
loaded. If it doesn't it will change the document.location.href value to
reload the page via the index page eg. http://mydomain.com/apage.asp becomes
http://mydomain.com/?url=apage.asp, reloading the page in a containing
frame.
To the user, the address displayed in the Address bar never changes, the
current document Title is displayed in IE's title bar.
Each page has the context menu disabled to stop users using the 'Add to
Favorites' and 'Properties' options to reveal the true url.
I place a Add to Favorites and and Email a Friend button on each page to
replace the built in IE functions
///////////////
The covenets of this is that users can defeat it if they have scripting
disabled in their browser settings so it is important to use