My problem is not setting the file size limit.
I want to display an error message when the users tries to upload a file
large then in maxRequestLength definied.
right now I have this in my webconfig
<httpRuntime executionTimeout="90" maxRequestLength="4096"
useFullyQualifiedRedirectUrl="false" minFreeThreads="8"
minLocalRequestFreeThreads="4" appRequestQueueLimit="100" />
If the users tries to upload files larger than 4MB he will get a page break
"The page cannot be displayed"..
I want to display a friendly page... (ex: saying the file you trying to
uploading is larger than 4MB)
- Kilic
"Teemu Keiski" <> wrote in message
news:...
> Hi,
>
> you can also set this on web.config. see <httpRuntime> element and
> especially maxRequestLength setting
>
http://msdn.microsoft.com/library/de...imesection.asp
>
> Just note that this effects entire application at once (if it is config
file
> on app root, on subfolder you can limit it to folder/page level)
>
> --
> Teemu Keiski
> MCP, Microsoft MVP (ASP.NET), AspInsider
> ASP.NET Forum Moderator, AspAlliance Columnist
> http://blogs.aspadvice.com/joteke
>
>
> "Kilic Beg" <> wrote in message
> news:...
> > Hi,
> >
> > I want to prevent user to upload files larger than 2MB.
> > If they try to upload I want to redirect them to a error page (ex: File
> > size
> > larger than 2 MB )..
> > right now I get a page break "The page cannot be displayed"
> >
> > I tried to update the Global.asax.cs file this is the code
> >
> > protected void Application_BeginRequest(Object sender, EventArgs e)
> > {
> > long MAX_CONTENTLENGTH = 2097152;
> > if (Request.ContentLength > MAX_CONTENTLENGTH) {
> > //Response.Write("File is to big");
> > Response.Redirecty("Error.html");
> > }
> > }
> >
> > I put the same code also into
> > protected void Application_Error(Object sender, EventArgs e)
> > method..
> >
> > still page break..
> >
> > where and how can I catch that and redirect to a friendly error page.
> > do I have to use a third party product for that ?
> >
> > Please help !!!
> >
> > Thanks
> >
> > - Kilic
> >
> >
> >
>
>