473,473 Members | 1,768 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Can't set 403 status?

When certain conditions are met on my ASPX pages, I want to set the status
of the response to 403, and have it handled by the custom 403 page I have
specified in my web.config file. Unfortunately it's not working. In my ASPX
page I have:

....
Response.StatusCode = 403;
....

In my web.config, I have:

<customErrors mode="On">
<error statusCode="403" redirect="403.aspx"/>
<error statusCode="404" redirect="404.aspx"/>
</customErrors>

If I do a Response.Write(Response.StatusCode) it says that it's 403, but I
never get redirected to the custom 403 page, it just continues loading the
page normally. Any thoughts?

Thanks,
Steve
Nov 18 '05 #1
3 3750
Hi Steve,
In the Internet Service Manager MMC, right-click the Web
site, and then select Properties.
Click the Custom Errors tab.
Choose the 403 HTTP error.
Edit Properties and give the file you want to display
Click OK, and then click Apply.

Hope that helps
Have a great day :)
R. Pooran Prasad
Itreya Technologies Pvt Ltd.,
Mail: po***********@itreya.com.REMOVETHIS
Phone(Off) : +91 80 5200179 Extn: 42
Mobile: +91 98860 29578
-----Original Message-----
When certain conditions are met on my ASPX pages, I want to set the statusof the response to 403, and have it handled by the custom 403 page I havespecified in my web.config file. Unfortunately it's not working. In my ASPXpage I have:

....
Response.StatusCode = 403;
....

In my web.config, I have:

<customErrors mode="On">
<error statusCode="403" redirect="403.aspx"/>
<error statusCode="404" redirect="404.aspx"/>
</customErrors>

If I do a Response.Write(Response.StatusCode) it says that it's 403, but Inever get redirected to the custom 403 page, it just continues loading thepage normally. Any thoughts?

Thanks,
Steve
.

Nov 18 '05 #2
I know how to change it via the IIS snap-in, but what I'm wondering is why
it doesn't work through the web.config file? Isn't the idea behind being
able to specify error redirects in the customErrors block, that you *don't*
have to use the IIS snap-in?

Steve

"Pooran Prasad" <po***********@itreya.com.REMOVETHIS> wrote in message
news:01****************************@phx.gbl...
Hi Steve,
In the Internet Service Manager MMC, right-click the Web
site, and then select Properties.
Click the Custom Errors tab.
Choose the 403 HTTP error.
Edit Properties and give the file you want to display
Click OK, and then click Apply.

Hope that helps
Have a great day :)
R. Pooran Prasad
Itreya Technologies Pvt Ltd.,
Mail: po***********@itreya.com.REMOVETHIS
Phone(Off) : +91 80 5200179 Extn: 42
Mobile: +91 98860 29578
-----Original Message-----
When certain conditions are met on my ASPX pages, I want

to set the status
of the response to 403, and have it handled by the custom

403 page I have
specified in my web.config file. Unfortunately it's not

working. In my ASPX
page I have:

....
Response.StatusCode = 403;
....

In my web.config, I have:

<customErrors mode="On">
<error statusCode="403" redirect="403.aspx"/>
<error statusCode="404" redirect="404.aspx"/>
</customErrors>

If I do a Response.Write(Response.StatusCode) it says that

it's 403, but I
never get redirected to the custom 403 page, it just

continues loading the
page normally. Any thoughts?

Thanks,
Steve
.

Nov 18 '05 #3
I should also note that this is all irrelevant, since even though I'm
setting Response.StatusCode = 403, I'm still getting my normal ASPX page
returned, *not* my custom one, and *not* the IIS default 403 handler.

Steve

"Steve - DND" <ng@digitalnothing.com> wrote in message
news:uT**************@TK2MSFTNGP11.phx.gbl...
I know how to change it via the IIS snap-in, but what I'm wondering is why
it doesn't work through the web.config file? Isn't the idea behind being
able to specify error redirects in the customErrors block, that you *don't* have to use the IIS snap-in?

Steve

"Pooran Prasad" <po***********@itreya.com.REMOVETHIS> wrote in message
news:01****************************@phx.gbl...
Hi Steve,
In the Internet Service Manager MMC, right-click the Web
site, and then select Properties.
Click the Custom Errors tab.
Choose the 403 HTTP error.
Edit Properties and give the file you want to display
Click OK, and then click Apply.

Hope that helps
Have a great day :)
R. Pooran Prasad
Itreya Technologies Pvt Ltd.,
Mail: po***********@itreya.com.REMOVETHIS
Phone(Off) : +91 80 5200179 Extn: 42
Mobile: +91 98860 29578
-----Original Message-----
When certain conditions are met on my ASPX pages, I want

to set the status
of the response to 403, and have it handled by the custom

403 page I have
specified in my web.config file. Unfortunately it's not

working. In my ASPX
page I have:

....
Response.StatusCode = 403;
....

In my web.config, I have:

<customErrors mode="On">
<error statusCode="403" redirect="403.aspx"/>
<error statusCode="404" redirect="404.aspx"/>
</customErrors>

If I do a Response.Write(Response.StatusCode) it says that

it's 403, but I
never get redirected to the custom 403 page, it just

continues loading the
page normally. Any thoughts?

Thanks,
Steve
.


Nov 18 '05 #4

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

Similar topics

8
by: mark4asp | last post by:
Why won't the window.status message change ? IE ver. 6.0.2800.1106 displays the tooltip OK. <td> <A HREF="editAuthor.asp?item=4" title="Edit author details"...
9
by: Ian Shere | last post by:
I have a disclaimer page prior to a visitor going to my FAQ page. I want to hide the link which normally appears in the status bar from visitors seeing it. I am using the following code which...
9
by: Simon Wigzell | last post by:
I have a little asp progress bar window that I open up with javascript, sized and located, all the extras turned off. It works by refreshing itself every second and displaying how much a file...
19
by: Frances | last post by:
Firefox is not respecting window.status, examples in this pg http://www.csua.berkeley.edu/~jgwang/jsform02.htm are ignored by Firefox.. why is this.. is there a solution.. thank you.. Frances
11
by: The Numerator | last post by:
How do you modify the status bar? (The status bar is the bar on the bottom in IE. It should read "Done" now.) I'm pretty sure, this requires JavaScript. Thanks.
3
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - I have window.status="Moomin"; why doesn't the statusbar change?...
2
by: Ethan Strauss | last post by:
Hi, I have a web service which is doing a lot of processing and taking 4-5 minutes to do so. The processing is split into several discrete steps and I would like for the service to be able to tell...
3
by: Strasser | last post by:
In a nested subform in datasheet view, an interviewer of homeless people picks a descriptive CATEGORY from 20 descriptive categories. The 20 categories are displayed via a combo box. (Categories...
8
by: rajesh | last post by:
< script language = javascript c =...
0
by: tvnaidu | last post by:
I wrote a status page HTML code, here I have 8 port status, it prints first 7 and last status it won't print, from there onwards it won't print footer also, if I make 10 instead 8, then it prints...
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...
1
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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
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...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.