Go Back   Velocity Reviews > Newsgroups > ASP Net
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

ASP Net - How to intercept error when httpRuntime maxRequestLength is exceded.

 
Thread Tools Search this Thread
Old 07-14-2004, 02:02 PM   #11
Default Re: How to intercept error when httpRuntime maxRequestLength is exceded.



[url]http://www.codeproject.com/useritems/FileSelectAndUploadDialog.asp[/url


-
Charit
-----------------------------------------------------------------------
Posted via http://www.codecomments.co
-----------------------------------------------------------------------



Charith
  Reply With Quote
Old 07-14-2004, 06:21 PM   #12
moondaddy
 
Posts: n/a
Default Re: How to intercept error when httpRuntime maxRequestLength is exceded.
My pages inherit from a base page so I don't have access to writing
attributes to the form element. You used 2 attributes that I've never used
before: enctype and action. Why are you using these and would they have
any effect on how errors are trapped in the global.asax? I'm still putting
break points on the Application_Error event and also the Global_Error event
but these events aren't executing. Can you offer any more advise on how to
trap this error so I can redirect to a page with a message to the user?
(btw: all of this code is running form a user control which contains all
the content for the page, and the page inherits from a base page)

The solution mentioned Charith in this thread looks like a good solution,
but I'm reluctant to use such JavaScript on the client due to possible
problems with downward browsers. Can anyone recommend some proven
JavaScript for this?

--

"[MSFT]" <> wrote in message
news:...
> Hello,
>
> Here is the web form code I use to test, you may test them on your server
> to see if they can work:
>
> <form id="Form1" method="post" enctype="multipart/form-data"
> action="WebForm1.aspx" runat="server">
>
> <INPUT id="oFile" type="file" runat="server"
> NAME="oFile">
>
> <br>
>
> <asp:button id="btnUpload" type="submit"
> text="Upload" runat="server"></asp:button>
>
> <aspanel ID="frmConfirmation"

Visible="False"
> Runat="server">
>
> <asp:Label id="lblUploadResult"
> Runat="server"></asp:Label>
>
> </aspanel>
>
> </form>
>
>
>
>
>
> Private Sub btnUpload_Click(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles btnUpload.Click
>
> Dim strFileName As String
>
> Dim strFilePath As String
>
> Dim strFolder As String
>
>
>
> strFolder = "C:\Test\"
>
>
>
> 'Get the name of the file that is posted.
>
> strFileName = oFile.PostedFile.FileName
>
> strFileName = Path.GetFileName(strFileName)
>
>
>
> 'Create the directory if it does not exist.
>
> If (Not Directory.Exists(strFolder)) Then
>
> Directory.CreateDirectory(strFolder)
>
> End If
>
>
>
> 'Save the uploaded file to the server.
>
> strFilePath = strFolder & strFileName
>
>
>
> If File.Exists(strFilePath) Then
>
> lblUploadResult.Text = strFileName & " already exists on the
> server!"
>
> Else
>
> oFile.PostedFile.SaveAs(strFilePath)
>
> lblUploadResult.Text = strFileName & " has been successfully
> uploaded."
>
> End If
>
>
>
> 'Display the result of the upload.
>
> frmConfirmation.Visible = True
>
>
>
> End Sub
>
>
> The problem may be related the web control you use. Therefore, we may

begin
> with a basic web form for test.
>
> Luke
>





moondaddy
  Reply With Quote
Old 07-14-2004, 07:22 PM   #13
moondaddy
 
Posts: n/a
Default Re: How to intercept error when httpRuntime maxRequestLength is exceded.
I forgot to mention, I also have this setting in my webconfig:
<customErrors mode="Off"/>
for testing. could this have any effect on how the Application_Error event
fires?

--

"moondaddy" <> wrote in message
news:%...
> My pages inherit from a base page so I don't have access to writing
> attributes to the form element. You used 2 attributes that I've never

used
> before: enctype and action. Why are you using these and would they have
> any effect on how errors are trapped in the global.asax? I'm still

putting
> break points on the Application_Error event and also the Global_Error

event
> but these events aren't executing. Can you offer any more advise on how

to
> trap this error so I can redirect to a page with a message to the user?
> (btw: all of this code is running form a user control which contains all
> the content for the page, and the page inherits from a base page)
>
> The solution mentioned Charith in this thread looks like a good solution,
> but I'm reluctant to use such JavaScript on the client due to possible
> problems with downward browsers. Can anyone recommend some proven
> JavaScript for this?
>
> --
>
> "[MSFT]" <> wrote in message
> news:...
> > Hello,
> >
> > Here is the web form code I use to test, you may test them on your

server
> > to see if they can work:
> >
> > <form id="Form1" method="post" enctype="multipart/form-data"
> > action="WebForm1.aspx" runat="server">
> >
> > <INPUT id="oFile" type="file" runat="server"
> > NAME="oFile">
> >
> > <br>
> >
> > <asp:button id="btnUpload" type="submit"
> > text="Upload" runat="server"></asp:button>
> >
> > <aspanel ID="frmConfirmation"

> Visible="False"
> > Runat="server">
> >
> > <asp:Label id="lblUploadResult"
> > Runat="server"></asp:Label>
> >
> > </aspanel>
> >
> > </form>
> >
> >
> >
> >
> >
> > Private Sub btnUpload_Click(ByVal sender As System.Object, ByVal e As
> > System.EventArgs) Handles btnUpload.Click
> >
> > Dim strFileName As String
> >
> > Dim strFilePath As String
> >
> > Dim strFolder As String
> >
> >
> >
> > strFolder = "C:\Test\"
> >
> >
> >
> > 'Get the name of the file that is posted.
> >
> > strFileName = oFile.PostedFile.FileName
> >
> > strFileName = Path.GetFileName(strFileName)
> >
> >
> >
> > 'Create the directory if it does not exist.
> >
> > If (Not Directory.Exists(strFolder)) Then
> >
> > Directory.CreateDirectory(strFolder)
> >
> > End If
> >
> >
> >
> > 'Save the uploaded file to the server.
> >
> > strFilePath = strFolder & strFileName
> >
> >
> >
> > If File.Exists(strFilePath) Then
> >
> > lblUploadResult.Text = strFileName & " already exists on the
> > server!"
> >
> > Else
> >
> > oFile.PostedFile.SaveAs(strFilePath)
> >
> > lblUploadResult.Text = strFileName & " has been successfully
> > uploaded."
> >
> > End If
> >
> >
> >
> > 'Display the result of the upload.
> >
> > frmConfirmation.Visible = True
> >
> >
> >
> > End Sub
> >
> >
> > The problem may be related the web control you use. Therefore, we may

> begin
> > with a basic web form for test.
> >
> > Luke
> >

>
>





moondaddy
  Reply With Quote
Old 07-15-2004, 07:13 AM   #14
[MSFT]
 
Posts: n/a
Default Re: How to intercept error when httpRuntime maxRequestLength is exceded.
This element didn't take any effect on application_error.

Luke



[MSFT]
  Reply With Quote
Old 07-15-2004, 06:02 PM   #15
moondaddy
 
Posts: n/a
Default Re: How to intercept error when httpRuntime maxRequestLength is exceded.
OK, so where do I go from here?

--

"[MSFT]" <> wrote in message
news:...
> This element didn't take any effect on application_error.
>
> Luke
>





moondaddy
  Reply With Quote
Old 07-16-2004, 04:29 AM   #16
[MSFT]
 
Posts: n/a
Default Re: How to intercept error when httpRuntime maxRequestLength is exceded.
Hello,

Form's Action property sets or retrieves the URL to which the form content
is sent for processing. EncType property sets or retrieves the Multipurpose
Internet Mail Extensions (MIME) encoding for the form.

Would you please post your client code for the form and <INPUT> component,
so I can know what is going on.

Regards,

Luke



[MSFT]
  Reply With Quote
Old 07-19-2004, 07:23 AM   #17
[MSFT]
 
Posts: n/a
Default Re: How to intercept error when httpRuntime maxRequestLength is exceded.
Hello,

I copied your files to my server and made some changes so that it can run
in the environment. It worked as expected, code in application_error was
executed. The main change I made the files is that I use Windows
authentication. I suggest you may create a new project with Windows
authentication and add this file to the project, to see if it will work.

Luke



[MSFT]
  Reply With Quote
Old 07-20-2004, 10:22 PM   #18
moondaddy
 
Posts: n/a
Default Re: How to intercept error when httpRuntime maxRequestLength is exceded.
OK I'll try it. Thanks for staying with me on this one. I'll make another
post here when I do to let you know what happened.

--

"[MSFT]" <> wrote in message
news:...
> Hello,
>
> I copied your files to my server and made some changes so that it can run
> in the environment. It worked as expected, code in application_error was
> executed. The main change I made the files is that I use Windows
> authentication. I suggest you may create a new project with Windows
> authentication and add this file to the project, to see if it will work.
>
> Luke
>





moondaddy
  Reply With Quote
Old 07-21-2004, 03:20 AM   #19
[MSFT]
 
Posts: n/a
Default Re: How to intercept error when httpRuntime maxRequestLength is exceded.
Thanks. I will look forward to your message.

Luke



[MSFT]
  Reply With Quote
Old 07-24-2004, 11:23 AM   #20
Nigil LaVey
 
Posts: n/a
Default Re: How to intercept error when httpRuntime maxRequestLength is exceded.
Greetings all...

I had this issue too... did u all manage to come out with a workaround?

regards,
Nigil Chua




Nigil LaVey
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

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




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46