473,795 Members | 3,024 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Throw System.Unauthor izedAccessExcep tion ?


I want to block access to my ASP.NET 2.0 web page if the time is
between 3:00 and 4:00. I know how to do the date math - is it proper
to throw an UnauthorizedAcc essException at that time? I want to pass
an "access denied" back to the browser but am not sure if that will
work.

Thanks

Jul 2 '08 #1
6 5662
Another idea could be redirecting the user to a custom page showing
access denied message.

/Anoj
[ www.TheTechHub.com ]

On Jul 3, 1:01*am, coconet <coco...@commun ity.nospamwrote :
I want to block access to my ASP.NET 2.0 web page if the time is
between 3:00 and 4:00. I know how to do the date math - is it proper
to throw an UnauthorizedAcc essException at that time? I want to pass
an "access denied" back to the browser but am not sure if that will
work.

Thanks
Jul 3 '08 #2

I don't want to do that because a crawling bot might be hitting the
page too. I want to show unauthorized access early in the HTTP
communication process, low level. Can I do that from within a ASPX
page?


On Wed, 2 Jul 2008 20:51:29 -0700 (PDT), Anoj <su********@gma il.com>
wrote:
>Another idea could be redirecting the user to a custom page showing
access denied message.

/Anoj
[ www.TheTechHub.com ]

On Jul 3, 1:01*am, coconet <coco...@commun ity.nospamwrote :
>I want to block access to my ASP.NET 2.0 web page if the time is
between 3:00 and 4:00. I know how to do the date math - is it proper
to throw an UnauthorizedAcc essException at that time? I want to pass
an "access denied" back to the browser but am not sure if that will
work.

Thanks
Jul 3 '08 #3
I would actually suggest against sending a 403 or some other HTTP
access denied because the crawlers may act adversly. The redirection
is a good idea. The crawlers will not care as long as it is a
temporary redirect, not a permanent one. Try something like this:

Response.Status Code = 302
Response.Status = "302 Moved Temporarily"
Response.AddHea der("Location", "/Unauthorized.as px") ' Note: "/
Unauthorized.as px" is just an example
Response.End()

Hope this helps.

On Jul 3, 10:49*am, coconet <coco...@commun ity.nospamwrote :
I don't want to do that because a crawling bot might be hitting the
page too. I want to show unauthorized access early in the HTTP
communication process, low level. Can I do that from within a ASPX
page?

On Wed, 2 Jul 2008 20:51:29 -0700 (PDT), Anoj <sutradh...@gma il.com>
wrote:
Another idea could be redirecting the user to a custom page showing
access denied message.
/Anoj
[www.TheTechHub.com]
On Jul 3, 1:01*am, coconet <coco...@commun ity.nospamwrote :
I want to block access to my ASP.NET 2.0 web page if the time is
between 3:00 and 4:00. I know how to do the date math - is it proper
to throw an UnauthorizedAcc essException at that time? I want to pass
an "access denied" back to the browser but am not sure if that will
work.
Thanks
Jul 3 '08 #4
"Norm" <ne*****@gmail. comwrote in message
news:ab******** *************** ***********@z32 g2000prh.google groups.com...
I would actually suggest against sending a 403 or some other HTTP
access denied because the crawlers may act adversly. The redirection
is a good idea. The crawlers will not care as long as it is a
temporary redirect, not a permanent one. Try something like this:

Response.Status Code = 302
Response.Status = "302 Moved Temporarily"
Response.AddHea der("Location", "/Unauthorized.as px") ' Note: "/
Unauthorized.as px" is just an example
Response.End()

Surley HTTP Status 401 Unauthorized would be better, along with response.end
(no redirect, the browser will just say unauthorized )
Jul 6 '08 #5

So throwing an UnauthorizedAcc essException is not the same as sending
a 401 in the HTTP Response?
On Sun, 6 Jul 2008 19:18:40 +0100, "Marc " <Rm********@ima rc.co.uk>
wrote:
>"Norm" <ne*****@gmail. comwrote in message
news:ab******* *************** ************@z3 2g2000prh.googl egroups.com...
I would actually suggest against sending a 403 or some other HTTP
access denied because the crawlers may act adversly. The redirection
is a good idea. The crawlers will not care as long as it is a
temporary redirect, not a permanent one. Try something like this:

Response.Statu sCode = 302
Response.Statu s = "302 Moved Temporarily"
Response.AddHe ader("Location" , "/Unauthorized.as px") ' Note: "/
Unauthorized.a spx" is just an example
Response.End ()

Surley HTTP Status 401 Unauthorized would be better, along with response.end
(no redirect, the browser will just say unauthorized )
Jul 7 '08 #6

If /unauthorized.as px does not exist, then body content will be sent
to the browser "page not found" or something. And if it does exist,
body content will still be sent to the browser. Is there a way to make
the client hang in a suspended state forever to keep a bot from ever
getting anything substantial from the server? What do you think of
activating one of the HTTP authentication schemes to put up a logon
box, that would make the bots go away and people too.

On Thu, 3 Jul 2008 12:27:59 -0700 (PDT), Norm <ne*****@gmail. com>
wrote:
>I would actually suggest against sending a 403 or some other HTTP
access denied because the crawlers may act adversly. The redirection
is a good idea. The crawlers will not care as long as it is a
temporary redirect, not a permanent one. Try something like this:

Response.Statu sCode = 302
Response.Statu s = "302 Moved Temporarily"
Response.AddHe ader("Location" , "/Unauthorized.as px") ' Note: "/
Unauthorized.a spx" is just an example
Response.End ()

Hope this helps.

On Jul 3, 10:49*am, coconet <coco...@commun ity.nospamwrote :
>I don't want to do that because a crawling bot might be hitting the
page too. I want to show unauthorized access early in the HTTP
communicatio n process, low level. Can I do that from within a ASPX
page?

On Wed, 2 Jul 2008 20:51:29 -0700 (PDT), Anoj <sutradh...@gma il.com>
wrote:
>Another idea could be redirecting the user to a custom page showing
access denied message.
>/Anoj
[www.TheTechHub.com]
>On Jul 3, 1:01*am, coconet <coco...@commun ity.nospamwrote :
I want to block access to my ASP.NET 2.0 web page if the time is
between 3:00 and 4:00. I know how to do the date math - is it proper
to throw an UnauthorizedAcc essException at that time? I want to pass
an "access denied" back to the browser but am not sure if that will
work.
>Thanks
Jul 7 '08 #7

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

Similar topics

5
5471
by: Burton Roberts | last post by:
This is also posted in the security newsgroup. Sorry for cross-posting, but I'm desperate. I have a Winforms application in VB.NET with a SQL Server (MSDE) backend. In the root application directory I have an XML file, LicXML.XML which holds licensing info for the app. On one group of machines where the users have restricted privileges, the deserialization of this file trips an error as follows (excuse mispellings from my client):
0
2477
by: Efi | last post by:
Hi, We have a simple 3 tier application which its core application is VC++ 6.0 ATL COM running as a server application in the COM+. An asp pipe is in charge of handling the requests and passes it to the COM for processing. We are now trying to migrate the asp pipe to Asp.Net. When running the above configuration with Asp.Net on IIS 5.0 (W2K) we have no problems but when trying the do it on IIS 6.0 (W2K3) we are getting the following...
7
4804
by: Peter Afonin | last post by:
Hello, I'm using this code to access a network share from an asp.net page: Dim dir As DirectoryInfo = New DirectoryInfo("\\10.0.0.150\FormLib\") Dim files() As FileInfo = dir.GetFiles("*.eps") When I try to do it, I get this error: System.UnauthorizedAccessException: Access to the path
0
1793
by: masago | last post by:
Hi....how are you ?? they can help me to solve this problem ?? Access to the path = "c:\windows\microsoft.net\framework\v1.1.4322\Temporary ASP.NET = Files\reports\06639073\bbab30a7" is denied.=20 Description: An unhandled exception occurred during the execution of the =
0
2332
by: nime | last post by:
I've got a problem. I cannot debug my app. which one contains WebBrowser control. I found a resolution but it's for an ASP related problem. I couldn't find a correct "user" to give permisson then I've added Everyone and refreshed policies (gpupdate /force), restarted VB IDE but still got the problem. What is the "worker process" for VB IDE? CODE:
2
14379
by: job | last post by:
In a sharepoint setup using smartpart to load our user controls using enterprise blocks (data) we are getting some strange errors (logged to the event log). We dont get the error all the time. When we get the error CPU goes 100% We have been through all we can think of, but have not been able to locate the source to the error. Any suggestions?
3
9204
by: BLUE | last post by:
I've created a folder named TestDir in my wwwroot and I've created the associated virtual application from IIS management snap-in. I've given full control to TestDir to: IUSR, ASPNET, Network service, Anonimous access, Everyone, Users, VS Developers I've set write access and low application protection from IIS management snap-in.
1
4606
by: nygiantswin2005 | last post by:
Hi I am trying to resolve this bug that I have in this application. The code is below. It will generate this Exception System.UnauthorizedAccessException: Access to the path is denied. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.__Error.WinIOError() at System.IO.FileInfo.MoveTo(String destFileName)
1
6675
by: JDS | last post by:
I am getting the following error in my application: System.UnauthorizedAccessException was unhandled Message="Access to the port is denied." Source="System" StackTrace: at System.IO.Ports.InternalResources.WinIOError(Int32 errorCode, String str) at System.IO.Ports.SerialStream.Dispose(Boolean disposing) at System.IO.Ports.SerialStream.Finalize()
0
9672
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10439
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10215
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10001
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9043
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7541
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6783
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5437
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
2920
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.