PDA

View Full Version : "Looks simple" : altering the "page can not be displayed" msg


avivit
03-05-2003, 11:43 AM
Hi

We have two websites:
1. On Internet
2. On INTRANET
Anyone with any internet account can access to the first site, but to enter to the 2nd, u need to have a special internet account (say, a certain supplier).

The general menu is on the Internet website, but one of the items in the sub-menu, links to a page On the INTRANET. If u r not authorized (=did not use the certain internet account), then u get the page "The page can not be displayed".

I'd like to replace this page with a "help" page that I will create (Btw - Better that the help page will be located on the general website).
How do I redirect the "page can not be displayed" to the help page, and of course, redirect it ONLY when the "page can not be displayed" page is there b/c of linking from this sub-menu, or b/c of trying to reach directly to the Intranet certain URL that this sub menu links to.

Thanks,
Avivit

raf
03-05-2003, 01:12 PM
euh ...
why include the item then in the main menu ?
can't you set a session-variable in your global.asa that indicates if it's an intra or inter-net client is ? And then have an if-then statement to determine if you shoulf display the menuitme (it's not really professional to include options someone can't use ...)

you global.asa can check for the clients IP; the NT-user name and a load of other stuf (see below) to find out where the request comes from.

if you don't wish to alter the menu (tsj tsj tsj), you can use the session variable to redirect the internet-clients to your helppage (with the same if-then-else on top of the asp-page where the menu-item points to.

more info from helpfile
-------------------------
ServerVariables
The ServerVariables collection retrieves the values of predetermined environment variables.

Syntax
Request.ServerVariables (server environment variable)

Parameters
server environment variable
Specifies the name of the server environment variable to retrieve. It can be one of the following values. Variable Description
ALL_HTTP All HTTP headers sent by the client.
ALL_RAW Retrieves all headers in the raw-form. The difference between ALL_RAW and ALL_HTTP is that ALL_HTTP places an HTTP_ prefix before the header name and the header-name is always capitalized. In ALL_RAW the header name and values appear as they are sent by the client.
APPL_MD_PATH Retrieves the metabase path for the (WAM) Application for the ISAPI DLL.
APPL_PHYSICAL_PATH Retrieves the physical path corresponding to the metabase path. IIS converts the APPL_MD_PATH to the physical (directory) path to return this value.
AUTH_PASSWORD The value entered in the client's authentication dialog. This variable is only available if Basic authentication is used.
AUTH_TYPE The authentication method that the server uses to validate users when they attempt to access a protected script.
AUTH_USER Raw authenticated user name.
CERT_COOKIE Unique ID for client certificate, Returned as a string. Can be used as a signature for the whole client certificate.
CERT_FLAGS bit0 is set to 1 if the client certificate is present.
bit1 is set to 1 if the Certifying Authority of the client certificate is invalid (not in the list of recognized CA on the server).

CERT_ISSUER Issuer field of the client certificate (O=MS, OU=IAS, CN=user name, C=USA).
CERT_KEYSIZE Number of bits in Secure Sockets Layer connection key size. For example, 128.
CERT_SECRETKEYSIZE Number of bits in server certificate private key. For example, e.g. 1024.
CERT_SERIALNUMBER Serial number field of the client certificate.
CERT_SERVER_ISSUER Issuer field of the server certificate.
CERT_SERVER_SUBJECT Subject field of the server certificate.
CERT_SUBJECT Subject field of the client certificate.
CONTENT_LENGTH The length of the content as given by the client.
CONTENT_TYPE The data type of the content. Used with queries that have attached information, such as the HTTP queries GET, POST, and PUT.
GATEWAY_INTERFACE The revision of the CGI specification used by the server. The format is CGI/revision.
HTTP_<HeaderName> The value stored in the header HeaderName. Any header other than those listed in this table must be prefixed by HTTP_ in order for the ServerVariables collection to retrieve its value.
Note The server interprets any underscore (_) characters in HeaderName as dashes in the actual header. For example if you specify HTTP_MY_HEADER, the server searches for a header sent as MY-HEADER.

HTTPS Returns ON if the request came in through secure channel (SSL) or it returns OFF if the request is for a non-secure channel.
HTTPS_KEYSIZE Number of bits in Secure Sockets Layer connection key size. For example, 128.
HTTPS_SECRETKEYSIZE Number of bits in server certificate private key. For example, 1024.
HTTPS_SERVER_ISSUER Issuer field of the server certificate.
HTTPS_SERVER_SUBJECT Subject field of the server certificate.
INSTANCE_ID The ID for the IIS instance in textual format. If the instance ID is 1, it appears as a string. You can use this variable to retrieve the ID of the Web-server instance (in the metabase) to which the request belongs.
INSTANCE_META_PATH The metabase path for the instance of IIS that responds to the request.
LOCAL_ADDR Returns the Server Address on which the request came in. This is important on multi-homed machines where there can be multiple IP addresses bound to a machine and you want to find out which address the request used.
LOGON_USER The Windows NTŪ account that the user is logged into.
PATH_INFO Extra path information as given by the client. You can access scripts by using their virtual path and the PATH_INFO server variable. If this information comes from a URL, it is decoded by the server before it is passed to the CGI script.
PATH_TRANSLATED A translated version of PATH_INFO that takes the path and performs any necessary virtual-to-physical mapping.
QUERY_STRING Query information stored in the string following the question mark (?) in the HTTP request.
REMOTE_ADDR The IP address of the remote host making the request.
REMOTE_HOST The name of the host making the request. If the server does not have this information, it will set REMOTE_ADDR and leave this empty.
REMOTE_USER Unmapped user-name string sent in by the User. This is the name that is really sent by the user as opposed to the ones that are modified by any authentication filter installed on the server.
REQUEST_METHOD The method used to make the request. For HTTP, this is GET, HEAD, POST, and so on.
SCRIPT_NAME A virtual path to the script being executed. This is used for self-referencing URLs.
SERVER_NAME The server's host name, DNS alias, or IP address as it would appear in self-referencing URLs.
SERVER_PORT The port number to which the request was sent.
SERVER_PORT_SECURE A string that contains either 0 or 1. If the request is being handled on the secure port, then this will be 1. Otherwise, it will be 0.
SERVER_PROTOCOL The name and revision of the request information protocol. The format is protocol/revision.
SERVER_SOFTWARE The name and version of the server software that answers the request and runs the gateway. The format is name/version.
URL Gives the base portion of the URL.

oracleguy
03-05-2003, 05:46 PM
There is thread set as a sticky at the top of the ASP forum about server variables.

Now when a person tries to access the site, do they get a HTTP 404 error? If so you can just change the 404 page on the server.

Morgoth
03-05-2003, 09:24 PM
Originally posted by oracleguy
There is thread set as a sticky at the top of the ASP forum about server variables.

Now when a person tries to access the site, do they get a HTTP 404 error? If so you can just change the 404 page on the server.

Will the Intranet 404 page for that server effect the internet 404 page?

whammy
03-06-2003, 04:04 AM
How do I redirect the "page can not be displayed" to the help page, and of course, redirect it ONLY when the "page can not be displayed" page is there b/c of linking from this sub-menu, or b/c of trying to reach directly to the Intranet certain URL that this sub menu links to.

In the above cases, you would have an:

HTTP_REFERER

(as in the request.servervariables collection) - so you should be able to check for the appropriate referer (or not) and redirect the user accordingly to whatever page you want.

Otherwise, I would just use a custom 404 error page.

:)

avivit
03-06-2003, 09:42 AM
Thanks

avivit
03-06-2003, 09:44 AM
Gateway Timeout
The following error occurred:
Server unreachable


--------------------------------------------------------------------------------
Please contact the administrator.


(And not "page can be displayed". Sorry)

whammy
03-07-2003, 12:49 AM
Hmm, that sounds like an entirely different error... not sure I have ever run into that, sorry... :-(

You might benefit from a google search, though. :confused: