473,320 Members | 1,861 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,320 software developers and data experts.

Sending Status as 401.1

We are trying to refuse data display to users based on some internal criteria. The site uses Basic Authentication for security.

Through ASP.NET we can send a status of 401. The request to our site comes from an application that understands the HTTP protocol.

If we send 401, the requsting application comes back to our application with the same user credentials. I read somewhere that 401 does not "exactly" mean access denied. The exact status code is 401.1 or 401.2.

The Status property of the Response object is an "int" - how can we send something like 401.1 or 401.2 from ASP.NET????

Thanks
Nov 18 '05 #1
7 5485
Hi, Dhwanil Shah,

I don't understand what you mean by this:
If we send 401, the requsting application comes back to our application

with the same user credentials.

Do they have a collection of user credentials? Normally every user has one
set of credentials and if the authentication fails that user can't use the
service.

Anyway, here is the list of custom error messages you might try to send:

http://msdn.microsoft.com/library/en...sreference.asp

I havent tested it, but you can try to send:

Response.Status = "401.2 Unauthorized: Access is denied due to server
configuration favoring an alternate authentication method.";

Most likely it will throw an HttpException "Status is set to an invalid
status code." though.

Greetings
Martin
Nov 18 '05 #2
Hi

I just need to send the value of 401.1 or 401.2 in Response.Status property. The Response.Status property is an int value i.e. I can only send 401 or 200 i.e. full numbers - no decimals allowed

How can I send an HTTP status code of 401.1 or 401.2 from ASP.NET

Thanks & Regard
Dhwanil Shah
Nov 18 '05 #3
Hi, Dhwanil,

I have not tested this, but you might want to try setting Response.Status to
4011 or 4012.

--
Regards,
Thomas Johansen (aka. Aylar)

Dhwanil Shah <an*******@discussions.microsoft.com> wrote:
Hi,

I just need to send the value of 401.1 or 401.2 in Response.Status
property. The Response.Status property is an int value i.e. I can
only send 401 or 200 i.e. full numbers - no decimals allowed.

How can I send an HTTP status code of 401.1 or 401.2 from ASP.NET?

Thanks & Regards
Dhwanil Shah

Nov 18 '05 #4
Hi, Dhwanil Shah,

The property Status on the System.Web.HttpResponse class is of type System
String:

http://msdn.microsoft.com/library/en...tatusTopic.asp

Anyway, it will throw HttpException "HTTP status string is not valid." if
you try to set it to a custom status code + status message combination.

Greetings
Martin
"Dhwanil Shah" <an*******@discussions.microsoft.com> wrote in message
news:41**********************************@microsof t.com...
Hi,

I just need to send the value of 401.1 or 401.2 in Response.Status property. The Response.Status property is an int value i.e. I can only send
401 or 200 i.e. full numbers - no decimals allowed.
How can I send an HTTP status code of 401.1 or 401.2 from ASP.NET?

Thanks & Regards
Dhwanil Shah

Nov 18 '05 #5
Thanks

I will check that ou

Regard
Dhwanil Shah
Nov 18 '05 #6
Martin

Sorry, I think we need to set StatusCode rather then the Status property.

I am not sure if sending a status code of 401 and Status i.e. description as 401.2 Access Denied will work or not. Also not sure whether .NET Framework will sync the description and the code.... will check out the lead anyway

Thanks
Dhwanil
Nov 18 '05 #7
Please note that there is no such thing as a 401.1 when it comes to the HTTP
headers themselves. (Watch using a network sniffer to confirm for
yourself).

When you see a 401.1 in IE, what's really happening is that IIS is sending
down a HTTP/401 error code in that HTTP Result, but the body text provides
the additional information you're seeing that claims it's really a 401.1

--
Thanks,

Eric Lawrence
Program Manager
Assistance and Worldwide Services

This posting is provided "AS IS" with no warranties, and confers no rights.
"Dhwanil Shah" <an*******@discussions.microsoft.com> wrote in message
news:B0**********************************@microsof t.com...
We are trying to refuse data display to users based on some internal criteria. The site uses Basic Authentication for security.
Through ASP.NET we can send a status of 401. The request to our site comes from an application that understands the HTTP protocol.
If we send 401, the requsting application comes back to our application with the same user credentials. I read somewhere that 401 does not "exactly"
mean access denied. The exact status code is 401.1 or 401.2.
The Status property of the Response object is an "int" - how can we send something like 401.1 or 401.2 from ASP.NET????
Thanks

Nov 18 '05 #8

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

Similar topics

1
by: Frits JK | last post by:
Hallo, I have a function in a DLL which is te interface between a xBase program and a PLC. most things work fine exept when I send or receive command-string contains a character 0. knows any...
5
by: fochie | last post by:
Greetings, I'm trying to send data to my server using xmlhttp POST. The data being sent is actually an HTML page that is built with javascript in the browser. The HTML code contains a small...
7
by: Geoff Cox | last post by:
Hello, I have been able to create a slider using Javascript code from the web but would like to send the slider values which are saved in an array to myself using email and the CGI/form...
5
by: vanisathish | last post by:
Hi All, I need to constantly update some values to the User Interface. In order to do the updation efficiently, i am planning to run some script in the server side that constantly keeps sending...
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...
4
by: OpticTygre | last post by:
I have a windows service, and a separate desktop application used to configure settings for the service. I'd also like to use the windows application as a sort of debug, or notification window, to...
5
by: Bert Bos | last post by:
Hi, when users are register on our website, their username, encrpyted password and so on are stored in the mySQL database. Many phpbb sites though send an activation mail to the email address...
1
by: sergiotb | last post by:
Hello everyone!! I'm trying to send a image (jpg) from a C# program to a CGI perl. The problem is that the code of the client C# is not working properly...I guess. The steps to send the image are: 1)...
10
by: Markgoldin | last post by:
I am sending an XML data from not dontnet process to a .Net via socket listener. Here is a data sample: <VFPData> <serverdata> <coderun>updateFloor</coderun> <area>MD2</area>...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.