Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Re: Throw System.UnauthorizedAccessException ?

Reply
Thread Tools

Re: Throw System.UnauthorizedAccessException ?

 
 
Anoj
Guest
Posts: n/a
 
      07-03-2008
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 <(E-Mail Removed)> wrote:
> 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 UnauthorizedAccessException at that time? I want to pass
> an "access denied" back to the browser but am not sure if that will
> work.
>
> Thanks


 
Reply With Quote
 
 
 
 
Norm
Guest
Posts: n/a
 
      07-03-2008
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.StatusCode = 302
Response.Status = "302 Moved Temporarily"
Response.AddHeader("Location", "/Unauthorized.aspx") ' Note: "/
Unauthorized.aspx" is just an example
Response.End()

Hope this helps.

On Jul 3, 10:49*am, coconet <(E-Mail Removed)> wrote:
> 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 <(E-Mail Removed)>
> 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 <(E-Mail Removed)> wrote:
> >> 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 UnauthorizedAccessException at that time? I want to pass
> >> an "access denied" back to the browser but am not sure if that will
> >> work.

>
> >> Thanks

 
Reply With Quote
 
 
 
 
Marc
Guest
Posts: n/a
 
      07-06-2008
"Norm" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
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.StatusCode = 302
Response.Status = "302 Moved Temporarily"
Response.AddHeader("Location", "/Unauthorized.aspx") ' Note: "/
Unauthorized.aspx" 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 )


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
To throw or to throw not? Emanuele D'Arrigo Python 6 11-15-2008 04:12 PM
clocking muxing, plz throw some light sudeepts@gmail.com VHDL 1 02-23-2006 06:43 PM
JNI's throw new does not throw an exception yarona@m-sys.com Java 15 09-08-2005 08:36 AM
throw an application wide event in an asp.net page PrashanthNagaraj ASP .Net 2 11-24-2003 12:48 AM
Throw Exception Vs Throw New Exception Kerri ASP .Net 2 10-27-2003 02:13 PM



Advertisments