Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Passing non existing IIS directory to ASP parameter

Reply
Thread Tools

Passing non existing IIS directory to ASP parameter

 
 
nungon
Guest
Posts: n/a
 
      07-15-2005
Good morning,

I have a web site in which 7 pages repeat once and again in thousands
of folders. Why? because I want to keep, to the user view, the pretty
url www.myweb.com/username/pageX.asp.

As you can imagine, this makes maintenance hard, because when I make
some update, I have to run a program to spread the change to the
xthousands directories.

A solution would be to change the url to
www.myweb.com/pageX.asp?u=username but the url wont be so easy to
remember, and probably it will not like our users.

My question is, in which way can I simulate this last behaviour, but
maintaining the "pretty" url, not only for accessing, but during the
navigation. The trick would be to catch the inexisting directory name
and pass it to the desired page as a parameter.

I have asked many people about that, and nobody can help. I would
appreciate someone of you can help me with this.

Thanks in advance,
Nungon.

 
Reply With Quote
 
 
 
 
CJM
Guest
Posts: n/a
 
      07-15-2005

"nungon" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
> Good morning,
>
> I have a web site in which 7 pages repeat once and again in thousands
> of folders. Why? because I want to keep, to the user view, the pretty
> url www.myweb.com/username/pageX.asp.
>
> As you can imagine, this makes maintenance hard, because when I make
> some update, I have to run a program to spread the change to the
> xthousands directories.
>
> A solution would be to change the url to
> www.myweb.com/pageX.asp?u=username but the url wont be so easy to
> remember, and probably it will not like our users.
>
> My question is, in which way can I simulate this last behaviour, but
> maintaining the "pretty" url, not only for accessing, but during the
> navigation. The trick would be to catch the inexisting directory name
> and pass it to the desired page as a parameter.
>
> I have asked many people about that, and nobody can help. I would
> appreciate someone of you can help me with this.
>
> Thanks in advance,
> Nungon.
>


If I understand you correctly...

Set the page for each user to simply Server.Transfer to a common page
elsewhere in the system... Changes to the common page will be reflected
automatically in the pages for each user.

Chris


 
Reply With Quote
 
 
 
 
nungon
Guest
Posts: n/a
 
      07-15-2005
Thanks Chris.
This, howerver, does not solve the problem, since I will had to keep
the xthousands directories.
I want to get rid of them, and just simulate that they exist.
Moreover, with that solution, the user will not see the "pretty" url
during the navigation.

Rgds...Nungon.

 
Reply With Quote
 
CJM
Guest
Posts: n/a
 
      07-15-2005

"nungon" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ups.com...
> Thanks Chris.
> This, howerver, does not solve the problem, since I will had to keep
> the xthousands directories.
> I want to get rid of them, and just simulate that they exist.
> Moreover, with that solution, the user will not see the "pretty" url
> during the navigation.
>
> Rgds...Nungon.
>


With Apache, you can use Mod_Rewrite to translate the 'pretty' URL in to the
practical URL. There is no direct equivalent, but there are 3rd-party ISAPI
filters that will do the same thing, but obvious you will have to pay for
these...

Eg...

www.mydomain.com/user/page.asp translates to
www.mydomain.com/commonpage.asp?username=user...

I've just noticed that IISToolshed has a free ISAPI filter listed:
http://www.iistoolshed.com/tools.aspx
Chris


 
Reply With Quote
 
swp
Guest
Posts: n/a
 
      07-15-2005
Nungon,

CJM's initial response is still best. Your problem states that it is
the users that are controling what you do, so keep the directories.
They will each contain 1 file, which is the default file for your
internet server (IIS, Apache, whatever). The contents of that 1 file
will be an include file off the root of your web site. That include
file will contain a simple page like this (which can be trimmed
considerably):
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<META HTTP-EQUIV="Refresh"
CONTENT="0;URL=http://www.whatever.org/Page0.asp">
<title>Redirect Page</title>
</head>
<body>
</body>
</html>


That immediately redirects them to the proper starting page. Use of
frames will keep the URL on the browser's address bar pure, so they
never know the difference.

If your users are sophisticated enough to right-click and open a new
window when clicking a link to another page, then they should not mind
what is in the address bar.

hth,

swp

 
Reply With Quote
 
nungon
Guest
Posts: n/a
 
      07-15-2005

Thanks both.
swp, your solution solves my problem with the maintenance of the asps,
which is much.
Nevertheless, I want to get rid of the xthousands directories.

I will try the ISAPI mentioned by CJM, no matter if I have to pay
something.

Thanks again,
Nungon.

 
Reply With Quote
 
Dave Anderson
Guest
Posts: n/a
 
      07-15-2005
nungon wrote:
> I have a web site in which 7 pages repeat once and again in
> thousands of folders. Why? because I want to keep, to the user
> view, the pretty url www.myweb.com/username/pageX.asp...
>
> ...My question is, in which way can I simulate this last
> behaviour, but maintaining the "pretty" url, not only for
> accessing, but during the navigation.


One possibility is a custom 404 handler. One really useful fact is that IIS
sticks the entire URL into Request.QueryString when it encounters a 404. In
the event that your URL does not exist, the QueryString looks like this:

404;http://www.myweb.com/username/pageX....5&recid=465431

(As a bonus, you still have access to QS elements the old fashioned way:
Request.QueryString("recid").Item)

If you parse the above string, you can get the username. Here is a JScript
example:

var a =
String(Request.QueryString.replace(/(^.+\/\/)|(\?.+$)/g,"").split("/")

Now a is an array with:

a[0] = "www.myweb.com"
a[1] = "username"
a[2] = "pageX.asp"

Perform a Server.Transfer or Server.Execute on pageX.asp...



--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.


 
Reply With Quote
 
Steven Burn
Guest
Posts: n/a
 
      07-15-2005
Use a custom 404 to handle the "usernames" and re-direct to the appropriate
"url";

http://aspfaq.com/show.asp?id=2162

That will allow you to get rid of the (x) directories

e.g.;

<script language="VBScript" runat=Server>
Dim objFSO
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FolderExists("./" &
StripAfterRoot(Request.ServerVariables("URL"))) Then
'// Folder exists so is probably not a user folder
Else
'// Folder does not exist so is probably a user folder
End If

Function StripAfterRoot(sPath)
'// Get rid of the http:// prefix
sPath = Replace(sPath, "http://", "")
'// Strip the path needed
<(root)> = (0)
username = (1)
page.xxx = (2)
StripAfterRoot = Split(sPath, "/")(1)
End Function
</script>

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

"nungon" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
> Good morning,
>
> I have a web site in which 7 pages repeat once and again in thousands
> of folders. Why? because I want to keep, to the user view, the pretty
> url www.myweb.com/username/pageX.asp.
>
> As you can imagine, this makes maintenance hard, because when I make
> some update, I have to run a program to spread the change to the
> xthousands directories.
>
> A solution would be to change the url to
> www.myweb.com/pageX.asp?u=username but the url wont be so easy to
> remember, and probably it will not like our users.
>
> My question is, in which way can I simulate this last behaviour, but
> maintaining the "pretty" url, not only for accessing, but during the
> navigation. The trick would be to catch the inexisting directory name
> and pass it to the desired page as a parameter.
>
> I have asked many people about that, and nobody can help. I would
> appreciate someone of you can help me with this.
>
> Thanks in advance,
> Nungon.
>



 
Reply With Quote
 
nungon
Guest
Posts: n/a
 
      07-15-2005
Many Thanks

I will try all the solutions.

So far I have tried (not in production) the ISAPI listed in IISToolshed
IonicIsapiRewriter1.0 and runs perfectly.
Just putting this in the ini ile

RewriteRule ^/(.*)/pageX.asp(.*) /pageX.asp$2&username=$1

and the work is done.

I wonder if this kind of isapi is very resource consuming since I serve
thousands of pages a minute.
Anyone has experienced it?

Rgds...Nungon.

 
Reply With Quote
 
CJM
Guest
Posts: n/a
 
      07-18-2005

"nungon" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
>
> I wonder if this kind of isapi is very resource consuming since I serve
> thousands of pages a minute.
> Anyone has experienced it?


This kind of filter shouldn't be very resource consuming, but it depends on
how well it was developed. The chances are it will be fine, but you'll find
out soon enough...

CJM


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing parameter to function not expecting parameter Mister B C Programming 8 08-26-2010 08:01 AM
How to copy a file to a non existing directory ? Martin Martinos Ruby 3 11-07-2006 10:44 PM
Re: IIS errormessage referrs non-existing linenumber Phil Winstanley [Microsoft MVP ASP.NET] ASP .Net 1 06-21-2004 11:58 AM
Re: IIS errormessage referrs non-existing linenumber Phil Winstanley [Microsoft MVP ASP.NET] ASP .Net 1 06-21-2004 11:35 AM
IIS errormessage referrs non-existing linenumber Christina N ASP .Net 0 06-21-2004 11:17 AM



Advertisments