473,832 Members | 2,107 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Application_Beg inRequest upload fichier trop gros

Bonjour à tous, voici mon problème : J'utilise asp.net 2.0, je me
suis fixée un <httpRuntime executionTimeou t="3000"
maxRequestLengt h="11264"/dans mon web.config pour pouvoir uploader
des fichier de maximum 10mg avec l'objet asp:fileupload. J'aimerais
pouvoir dire à mes utilisateurs lorsqu'ils sélectionnent des fichiers
de plus de 10mg : "Fichier trop volumineux... bla bla bla...". j'ai
même suivi le conceil de plusieur et mettre une validation dans le
global.asax :
Sub Application_Beg inRequest(ByVal sender As Object, ByVal e As
EventArgs)
Try
Dim i As Integer
'En bite : 10 mg
Dim iMaxFileSize As Integer = 10485760
For i = 0 To Request.Files.C ount - 1
If Request.Files.I tem(i).ContentL ength iMaxFileSize
Then
Response.Redire ct("redirect.ht m")
Exit For
End If
Next
Catch ex As Exception
Response.Redire ct("redirect.ht m")
End Try
End Sub

Mais lorsqu'il arrive sur Request.Files.C ount si le fichier est plus
gros que le size dans le web.config, il plate, l'erreur est catcher par
le try mais il ne fait pas le redirect. Il affiche quand même :
"Impossible d'afficher la page...". comme lorsqu'il n'y avait aucune
validation dans le beginRequest.

J'ai fouillée autant comme autant sur les forum, sur le support de
microsoft et je n'ai rien trouvé autre que modifier le machin.config
pour qui redirige vers une page générique, mais dans mon cas ce n'est
vraiment pas souhaitable étant donnée de notre serveur héberge
d'autre application.

Quelqu'un à une idée?????
Merci d'avance!

Sep 21 '06 #1
2 2212
Here a translation of my last message, you will understand that English
is not my mother langage.

Hello, here my problem : i uses asp.net 2.0, I configured <httpRuntime
executionTimeou t="3000" maxRequestLengt h="11264"/>in my web.config to
be able upload file of 10mg maximum with the asp:fileupload object.
I would like to be able to say at my users when they upload files more
than 10mg: "too big File... ". I followed the conceil of several and to
put a validation in the global.asax :
Sub Application_Beg inRequest(ByVal sender As Object, ByVal e As
EventArgs)
Try
Dim i As Integer
Dim iMaxFileSize As Integer = 10485760
For i = 0 To Request.Files.C ount - 1
If Request.Files.I tem(i).ContentL ength iMaxFileSize
Then
Response.Redire ct("redirect.ht m")
Exit For
End If
Next
Catch ex As Exception
Response.Redire ct("redirect.ht m")
End Try
End Sub

But when it arrives on Request.Files.C ount if the file is larger than
the size in the web.config, it punt, the error is catch by the try but
it does not make the redirect. It posts nevertheless: "Impossible to
post the page...". as when there was no validation in the beginRequest.

On the forum, on the support of Microsoft, I did not find anything
other but to modify the machin.config for which redirects towards a
generic page, but in my case it is really not desirable being given of
our waiter lodges other applications.

Sep 21 '06 #2
microsoft.publi c.fr.dotnet.asp net
est le groupe pour les messages écrits en français

SVP, poteau là.

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/
=============== =============== =====
<sa************ **@gmail.comwro te in message
news:11******** **************@ d34g2000cwd.goo glegroups.com.. .
Bonjour à tous, voici mon problème : J'utilise asp.net 2.0, je me
suis fixée un <httpRuntime executionTimeou t="3000"
maxRequestLengt h="11264"/dans mon web.config pour pouvoir uploader
des fichier de maximum 10mg avec l'objet asp:fileupload. J'aimerais
pouvoir dire à mes utilisateurs lorsqu'ils sélectionnent des fichiers
de plus de 10mg : "Fichier trop volumineux... bla bla bla...". j'ai
même suivi le conceil de plusieur et mettre une validation dans le
global.asax :
Sub Application_Beg inRequest(ByVal sender As Object, ByVal e As
EventArgs)
Try
Dim i As Integer
'En bite : 10 mg
Dim iMaxFileSize As Integer = 10485760
For i = 0 To Request.Files.C ount - 1
If Request.Files.I tem(i).ContentL ength iMaxFileSize
Then
Response.Redire ct("redirect.ht m")
Exit For
End If
Next
Catch ex As Exception
Response.Redire ct("redirect.ht m")
End Try
End Sub

Mais lorsqu'il arrive sur Request.Files.C ount si le fichier est plus
gros que le size dans le web.config, il plate, l'erreur est catcher par
le try mais il ne fait pas le redirect. Il affiche quand même :
"Impossible d'afficher la page...". comme lorsqu'il n'y avait aucune
validation dans le beginRequest.

J'ai fouillée autant comme autant sur les forum, sur le support de
microsoft et je n'ai rien trouvé autre que modifier le machin.config
pour qui redirige vers une page générique, mais dans mon cas ce n'est
vraiment pas souhaitable étant donnée de notre serveur héberge
d'autre application.

Quelqu'un à une idée?????
Merci d'avance!
Sep 21 '06 #3

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

Similar topics

3
11773
by: dave | last post by:
Hello there, I am at my wit's end ! I have used the following script succesfully to upload an image to my web space. But what I really want to be able to do is to update an existing record in a table in MySQL with the path & filename to the image. I have successfully uploaded and performed an update query on the database, but the problem I have is I cannot retain the primary key field in a variable which is then used in a SQL update...
2
1794
by: Alexandre Jaquet | last post by:
Hi, I can't figure what I've doing wrong with my code : in my Form : <form name="form1" method="post" action="do_inscription.php"> <p align="center"><img src="images/logo.jpg" width="400" height="80"></p> <div align="center"> <table width="500" border="0">
5
5078
by: Slasher | last post by:
Bonjour, j'ai commencé à faire un petit script qui permet d'éditer un fichier, or lorsque le fichier en question est vide, j'obtient un message du type "L'entrée dépasse la fin du fichier". Comment faire ?
0
2290
by: SBA03 | last post by:
J'ai une vue de jointure bassée sur plusieurs tables, je peux mettre à jour cette vue grâce à un trigger instead of. Je voudrai charger un fichier csv dont la structure est basée sur celle de ma vue dans ma base ORacle 8.1.7. Existe-t-il une autre solution que lire le fichier ligne et ligne et lancer les ordres d'insert unitairement.
0
1424
by: isore | last post by:
Convertion php to asp.net : PB lecture fichier .ini URGENT URGENT URGENT URGENT URGENT URGENT J'ai un code en php (http://parisports.free.fr) mais le client veut le même en asp.net J'ai converti le php en asp avec la moulinette windows http://81.56.65.81 J'y connais rien mais la bibliotheque de lecture du fichier d'echange (fichier.ini) ne fonctionne plus
3
18355
by: Paul Daly (MCP) | last post by:
I'm trying to write a log file that captures the referring url if the request is a new session, and captures a querystring value if the user is browsing between pages on the website. When using the code below, I get the following error... "System.NullReferenceException: Object reference not set to an instance of an object" ****************************************** protected void Session_Start(Object sender, EventArgs e) { System.Uri...
7
5242
by: Ankit Aneja | last post by:
I put the code for url rewrite in my Application_BeginRequest on global.ascx some .aspx pages are in root ,some in folder named admin and some in folder named user aspx pages which are in user folder are using this code of url rewrite project is running completely fine on localhost but after uploading first page (http://emailware.net.temporary.domain.name/user/index.aspx) is fine but as i click 123 Easy-CD Ripper
0
1434
by: Rahul | last post by:
Earlier this evening i posted a question that my debug point is hit several times, But after I published the application. I could significantly see less round trip per request for Application_Begin Request. So in my Application_Beginrequest function i am writing a line to the event viewer.I see that for each request my event viewer has 3 entries.
3
2685
by: =?Utf-8?B?bXVzb3NkZXY=?= | last post by:
Hi guys I've used an Application_BeginRequest function in my global.asax page to implement some URL rewriting functionality on our website. However, upon moving it to my host (1&1.co.uk), it no longer works. They don't support Application_BeginRequest? They've given me a list of the low-level functions they do support, which can be viewed at http://s221042302.websitehome.co.uk/check.aspx
0
9796
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
9642
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10543
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10213
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
9323
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
7753
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
5789
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4422
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3972
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.