Blog

My blog serves as a way for me to post solutions to problems I solve at work or during the long hours of freelance work.


Maximum request length exceeded.

by Ezekiel 10. June 2012 16:27

 

I was getting this error message when uploading more then two image files.

 

Add this to your web.confg -

<httpRuntime requestValidationMode="2.0" maxRequestLength="20192" />

 

 

Tags: , ,

.NET 4.0 | ASP.NET | MVC

C# Calling a Method Asynchronously using a Delegate

by Ezekiel 6. December 2011 07:16

 

 using System;

namespace NameSpaceName
{
    public class ClassName
    {
        private delegate void MyDelegate();
        private static MyDelegate caller;

        public static void Method()
        {
            // Log user action in audit log
            caller = new MyDelegate(MethodToCallFromDelegate);
            IAsyncResult result = caller.BeginInvoke(null, null);
        }

        private static void MethodToCallFromDelegate()
        {
           
        }
    }
}

Tags: , , ,

.NET 4.0 | C#

ASP.NET 4.0 Web.config Transform

by Ezekiel 16. November 2011 02:18

 

If you are converting an old app which uses the old style of web.config. For example, having multiple config files named dev, qa, live etc. and you want to use the new transform build features.

You have go to the properties of the web.config, Build Action: Content. Otherwise, publishing will publish all the .config files. 

 

Tags: ,

.NET 4.0 | ASP.NET

Could not load file or assembly 'AjaxControlToolkit' or one of its dependencies. Access is denied.

by Ezekiel 23. September 2011 05:27

 

1. Open IIS

2. Select the app pool the application uses.

3. Click Advanced Settings 4. Change Enable 32-bit Application.

5. Save changed and recycle app pool.

Tags: ,

.NET 4.0 | IIS

ASP.NET 4.0 SEO URL Routing

by Ezekiel 8. December 2010 06:44

 

Add this to your Global.asax.cs file -

 

        void Application_Start(object sender, EventArgs e)
        {
            RegisterRoutes(RouteTable.Routes);
        }

        void RegisterRoutes(RouteCollection routes)

        {
            // Ignore request for resource files
            routes.Ignore("{resource}.axd/{*pathInfo}");

            // Register a route for forms/{formName}
            routes.MapPageRoute(
               "SignOnRequest",
               "forms/{formName}",
               "~/SignOnRequest.aspx"
            );
        }

 

 

There's many different ways to reference this route in your code -

 

Page.GetRouteUrl("SignOnRequest", new { formName = "signonrequest" });

http://www.yourdomain.com/forms/signonrequest

 

Tags: , , ,

.NET 4.0 | ASP.NET | C#

ValidateRequest="false" Doesn't Work in ASP.NET 4.0

by Ezekiel 19. November 2010 11:09

 

I just upgraded my site from 3.5 to 4.0.  Ran into a problem with adding entries to my blog.  When saving new posts with HTML the app was blowing up.  Here is the solution.

 

<system.web>
    <compilation debug="true" targetFramework="4.0" />
    <httpRuntime requestValidationMode="2.0" />
</system.web>

Tags: , ,

ASP.NET | .NET 4.0

RecentPosts