Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Make my site appear to have directories when they actually don’t e

Reply
Thread Tools

Make my site appear to have directories when they actually don’t e

 
 
codeboy
Guest
Posts: n/a
 
      12-07-2009
I’d like to have my users point their browsers to subdirectories that do not
exist and have them all handled by one aspx page. For example if a user trys
to go to www.mysite.com/fakedir1, www.mysite.com/fakedir2, or
www.mysite.com/fakedir3 they will all be handled by
www.mysite.com/mypage.aspx. I don’t know what fake directories will be
needed so I’d like it to happen for all subdirectories. I’d also like the
user to think they are actually in the dir. So the browser will need to
continue to reflect the dir they actually requested.
 
Reply With Quote
 
 
 
 
Alexey Smirnov
Guest
Posts: n/a
 
      12-07-2009
On Dec 7, 3:18*am, codeboy <(E-Mail Removed)> wrote:
> Id like to have my users point their browsers to subdirectories that do not
> exist and have them all handled by one aspx page. *For example if a user trys
> to go towww.mysite.com/fakedir1,www.mysite.com/fakedir2, orwww.mysite.com/fakedir3they will all be handled bywww.mysite.com/mypage.aspx. *I dont know what fake directories will be
> needed so Id like it to happen for all subdirectories. *Id also like the
> user to think they are actually in the dir. *So the browser will need to
> continue to reflect the dir they actually requested. *


This technique called URL Rewriting, see more
http://www.google.com/search?q=url+rewrite+asp.net
 
Reply With Quote
 
 
 
 
Gregory A. Beamer
Guest
Posts: n/a
 
      12-07-2009
Alexey Smirnov <(E-Mail Removed)> wrote in news:63d3d4b6-caaa-
http://www.velocityreviews.com/forums/(E-Mail Removed):

> This technique called URL Rewriting, see more
> http://www.google.com/search?q=url+rewrite+asp.net


I think he can probably use the 404 error in this condition, rather than
URL rewriting. I had thought that direction too, at first, but if he
wants all non-existant directories to go to one page, the 404 should
solve that. If it does not solve it all, an examination of HTML return
codes should find the exceptions to the redirect and solve it.

Peace and Grace,

--
Gregory A. Beamer (MVP)

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

*******************************************
| Think outside the box! |
*******************************************
 
Reply With Quote
 
Krishna
Guest
Posts: n/a
 
      12-10-2009
Hi Gregory

can you tell me how to do the following which u said in the below query?

"the 404 should solve that. If it does not solve it all, an examination of
HTML return
codes should find the exceptions to the redirect and solve it"

Thanks

"Gregory A. Beamer" wrote:

> Alexey Smirnov <(E-Mail Removed)> wrote in news:63d3d4b6-caaa-
> (E-Mail Removed):
>
> > This technique called URL Rewriting, see more
> > http://www.google.com/search?q=url+rewrite+asp.net

>
> I think he can probably use the 404 error in this condition, rather than
> URL rewriting. I had thought that direction too, at first, but if he
> wants all non-existant directories to go to one page, the 404 should
> solve that. If it does not solve it all, an examination of HTML return
> codes should find the exceptions to the redirect and solve it.
>
> Peace and Grace,
>
> --
> Gregory A. Beamer (MVP)
>
> Twitter: @gbworld
> Blog: http://gregorybeamer.spaces.live.com
>
> *******************************************
> | Think outside the box! |
> *******************************************
> .
>

 
Reply With Quote
 
Gregory A. Beamer
Guest
Posts: n/a
 
      12-10-2009
=?Utf-8?B?S3Jpc2huYQ==?= <(E-Mail Removed)> wrote in
news:(E-Mail Removed):

> "the 404 should solve that. If it does not solve it all, an
> examination of HTML return
> codes should find the exceptions to the redirect and solve it"


In web.config find the custom errors element. You can handle the 404
like this:

<customErrors defaultRedirect="ErrorPage.aspx" mode="On">
<error statusCode="404" redirect="filenotfound.aspx" />
</customErrors>

Here are a list of HTTP codes you can handle:

http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html

This means you can do the following, if you wish:

<customErrors>
<error statusCode="400" redirect="BadRequest.aspx" />
<error statusCode="401" redirect="Unauthorized.aspx" />
<error statusCode="403" redirect="Forbidden.aspx" />
<error statusCode="404" redirect="NotFound.aspx" />
<error statusCode="405" redirect="MethodNotAllowed.aspx" />
<error statusCode="406" redirect="NotAcceptable.aspx" />
<error statusCode="407"
redirect="ProxyAuthenticationRequired.aspx" />
<error statusCode="408" redirect="RequestTimeout.aspx" />
<error statusCode="409" redirect="Conflict.aspx" />
<error statusCode="410" redirect="Gone.aspx" />
<error statusCode="411" redirect="LengthRequired.aspx" />
<error statusCode="412" redirect="PreconditionFailed.aspx" />
<error statusCode="413" redirect="RequestEntityTooLarge.aspx" />
<error statusCode="414" redirect="RequestUriTooLong.aspx" />
<error statusCode="415" redirect="UnsupportedMediaType.aspx" />
<error statusCode="416"
redirect="RequestRangeNotSatisfiable.aspx" />
<error statusCode="417" redirect="ExpectationFailed.aspx" />
<error statusCode="500" redirect="InternalServerError.aspx" />
<error statusCode="501" redirect="NotImplemented.aspx" />
<error statusCode="502" redirect="BadGateway.aspx" />
<error statusCode="503" redirect="ServiceUnavailable.aspx" />
<error statusCode="504" redirect="GatewayTimeout.aspx" />
<error statusCode="505" redirect="HttpVersionNotSupported.aspx" />
</customErrors>

Note that it is either impossible or nearly impossible to hit some of
these with a web site, but it gives you the idea.

Peace and Grace,


--
Gregory A. Beamer (MVP)

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

*******************************************
| Think outside the box! |
*******************************************
 
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
Make my site appear to have directories when they actually don’t e codeboy ASP .Net 1 12-07-2009 05:30 PM
Make my site appear to have directories when they actually don’t e codeboy ASP .Net 1 12-07-2009 04:52 PM
Make my site appear to have directories when they actually don’t e codeboy ASP .Net 0 12-07-2009 01:59 AM
What camera trickery could I use to make objects appear larger than they really are? Jeff Ingram Digital Photography 17 06-18-2005 03:28 PM
they turn, they power, they make nice pics Keith and Jenn Z. Digital Photography 0 09-21-2003 04:16 AM



Advertisments