473,394 Members | 2,031 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Sending a 403 response

I have an application which uses Windows Authentication to identify users
and ensure that they are on a domain. Once access is granted at this level,
I then check their login name against a database of validated users to
determine whether the particular user can actually use the system.

If a user is not in the database, I want to respond with the same error page
as would be seen if they failed the windows authentication; the 403
forbidden access page. I have tried setting Response.StatusCode to 403 and
then calling Response.End() but this simply leaves the client with an empty
page. How do I have IIS automatically divert to whatever the current 403
page on the site is?

Cheers.
Mar 7 '06 #1
4 2020
re:
I have tried setting Response.StatusCode to 403 and then calling Response.End() but this simply
leaves the client with an empty page. How do I have IIS automatically divert to whatever the current 403 page on the site is?
You could copy the 403 page to your application,
from drive:\WINDOWS\Help\iisHelp\common , and response.redirect to it
if the client fails authentication in the database of validated users.

You could also raise an exception, based on the client not being found in
your database of validated users, and response.redirect based on that.

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"Martin Robins" <martin dot robins at technicaldirect dot co dot uk> wrote in message
news:Oh**************@TK2MSFTNGP09.phx.gbl...I have an application which uses Windows Authentication to identify users and ensure that they are
on a domain. Once access is granted at this level, I then check their login name against a database
of validated users to determine whether the particular user can actually use the system.

If a user is not in the database, I want to respond with the same error page as would be seen if
they failed the windows authentication; the 403 forbidden access page. I have tried setting
Response.StatusCode to 403 and then calling Response.End() but this simply leaves the client with
an empty page. How do I have IIS automatically divert to whatever the current 403 page on the site
is?

Cheers.

Mar 7 '06 #2
Am I to take it then that there is no built in support for this?

(BTW: ASP.net 2.0)
"Juan T. Llibre" <no***********@nowhere.com> wrote in message
news:%2***************@TK2MSFTNGP14.phx.gbl...
re:
I have tried setting Response.StatusCode to 403 and then calling
Response.End() but this simply leaves the client with an empty page.

How do I have IIS automatically divert to whatever the current 403 page on
the site is?


You could copy the 403 page to your application,
from drive:\WINDOWS\Help\iisHelp\common , and response.redirect to it
if the client fails authentication in the database of validated users.

You could also raise an exception, based on the client not being found in
your database of validated users, and response.redirect based on that.

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"Martin Robins" <martin dot robins at technicaldirect dot co dot uk> wrote
in message news:Oh**************@TK2MSFTNGP09.phx.gbl...
I have an application which uses Windows Authentication to identify users
and ensure that they are on a domain. Once access is granted at this
level, I then check their login name against a database of validated users
to determine whether the particular user can actually use the system.

If a user is not in the database, I want to respond with the same error
page as would be seen if they failed the windows authentication; the 403
forbidden access page. I have tried setting Response.StatusCode to 403
and then calling Response.End() but this simply leaves the client with an
empty page. How do I have IIS automatically divert to whatever the
current 403 page on the site is?

Cheers.


Mar 7 '06 #3
DWS
Martin,

C:\WINDOWS\Help\iisHelp\common
Copy the page to your application for maximum portability.
response.redirect("403-2.htm")

Good Luck
DWS

PS Please vote for one of my designs "The Hand is Quicker Than the Eye" or
"Software" http://blog.mix06.com/contest/gallery/default.aspx

Thanks
DWS

"Martin Robins" wrote:
I have an application which uses Windows Authentication to identify users
and ensure that they are on a domain. Once access is granted at this level,
I then check their login name against a database of validated users to
determine whether the particular user can actually use the system.

If a user is not in the database, I want to respond with the same error page
as would be seen if they failed the windows authentication; the 403
forbidden access page. I have tried setting Response.StatusCode to 403 and
then calling Response.End() but this simply leaves the client with an empty
page. How do I have IIS automatically divert to whatever the current 403
page on the site is?

Cheers.

Mar 7 '06 #4
Raising an exception, based on the client not being found in your database
of validated users, and response.redirecting based on that is an ASP.NET 2.0
way of doing what you want to do.

ASP.NET doesn't have anything to do with HTTP Status Codes. IIS does.

In order for an IIS status code exception to be redirected to a custom page,
it has to be handled by IIS itself.

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"Martin Robins" <martin dot robins at technicaldirect dot co dot uk> wrote in message
news:uI**************@TK2MSFTNGP09.phx.gbl...
Am I to take it then that there is no built in support for this?

(BTW: ASP.net 2.0)
"Juan T. Llibre" <no***********@nowhere.com> wrote in message
news:%2***************@TK2MSFTNGP14.phx.gbl...
re:
I have tried setting Response.StatusCode to 403 and then calling Response.End() but this simply
leaves the client with an empty page.

How do I have IIS automatically divert to whatever the current 403 page on the site is?


You could copy the 403 page to your application,
from drive:\WINDOWS\Help\iisHelp\common , and response.redirect to it
if the client fails authentication in the database of validated users.

You could also raise an exception, based on the client not being found in
your database of validated users, and response.redirect based on that.

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"Martin Robins" <martin dot robins at technicaldirect dot co dot uk> wrote in message
news:Oh**************@TK2MSFTNGP09.phx.gbl...
I have an application which uses Windows Authentication to identify users and ensure that they
are on a domain. Once access is granted at this level, I then check their login name against a
database of validated users to determine whether the particular user can actually use the system.

If a user is not in the database, I want to respond with the same error page as would be seen if
they failed the windows authentication; the 403 forbidden access page. I have tried setting
Response.StatusCode to 403 and then calling Response.End() but this simply leaves the client
with an empty page. How do I have IIS automatically divert to whatever the current 403 page on
the site is?

Cheers.



Mar 7 '06 #5

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

Similar topics

5
by: BaWork | last post by:
I have a web form where a client can select which site members to send an email to. This form is populated from the contents of the member table, so the form can have 0-x names listed on it...
0
by: PJ | last post by:
I have the following code snippet to send a file stored as an image data type from sql server: Protected Sub StreamFile(ByVal fileItem As MyFile) Dim offset As Integer Dim buffer As Integer =...
7
by: Jay Douglas | last post by:
Hello all, I have a asp.net page that creates a pdf on the fly and sends the pdf down to the browser. When calling the page up in IE the Page_Load event is fried twice. This doesn't happen with...
7
by: Lau | last post by:
I need to send 1000 emails from an asp.net website. Normally I would use System.Web.Mail.MailMessage() to send thru an SMTP server. But the large amount of emails results in a timeout. My server...
5
by: Vishal | last post by:
Hello, I already asked this question in the ASP.NET forums, but no help came. So I am hoping that somebody can help me out. This is really very URGENT me. For my e-commerce application, I...
0
by: Buddy Ackerman | last post by:
I'm sending file to the client (see sample code below) but when I send a large file the user gets a document contains no data message. response.contenttype = "application/x-unknown" myheader =...
1
by: Lars Netzel | last post by:
I have an XLS file that I try to send to the webclient via ASP.NET. When sending I use this code... Response.ClearContent() Response.ClearHeaders() Response.ContentType =...
1
by: Dirk Goossens | last post by:
Hello! I'm sending E-mails to mailadresses in a table, using the code below. How can I send more than one attachment? Access can find the file to be send in this field: MY_EMAILATTACHMENT_FIELD...
4
by: yawnmoth | last post by:
Is it possible to send http requests with curl but not have curl wait for the response? The reason I ask is because I'd like to code a web app that can sorta start time consuming processes...
7
by: Jason1983 | last post by:
Hello sir, When iam trying to send emails to my user accounts which are gmail id's using my application it is giving me this error. Here is the error... Server object error 'ASP 0177 : 800401f3'...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...
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...

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.