(Very) Weird AllowedFileExtensions Problem

Thread is closed for posting
5 posts, 0 answers
  1. -DJ-
    -DJ- avatar
    263 posts
    Member since:
    Oct 2004

    Posted 15 Apr 2009 Link to this post


    Hi guys,

    This problem I'm facing is so weird that I cannot really believe it.

    1    Dim intRows As Integer = ds.Tables(0).Rows.Count() 
    2    upload.AllowedFileExtensions = New String(intRows) {} 
    3    Dim x As Integer 
    4    For Each row As DataRow In ds.Tables(0).Rows 
    5        'upload.AllowedFileExtensions.SetValue("." & row("FileTypeEnding"), x) 
    6        upload.AllowedFileExtensions.SetValue(row("FileTypeEnding"), x) 
    7        x += 1 
    8    Next 

    On my dev machine, running XP and IIS 5, line 6 works as expected.
    But not on my server, running Server 2003 and IIS 6. There it's line 5 that works correctly.

    Can you believe it?

    Regards,
    -DJ-
  2. Erjan Gavalji
    Admin
    Erjan Gavalji avatar
    1455 posts

    Posted 20 Apr 2009 Link to this post

    Hi -DJ-,

    That's a very interesting one!

    I haven't come across such a behavior, but it could possibly be related to some environment setting on the server. FYI, I've always used the syntax with a dot and it has worked correctly. You could try something like File.GetExtension("." & row("FileTypeEnding"))...

    Just to make sure, can you check if you have the same entries (with a leading dot) on both the server and the development machines?

    Kind regards,
    Erjan Gavalji
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. -DJ-
    -DJ- avatar
    263 posts
    Member since:
    Oct 2004

    Posted 22 Apr 2009 Link to this post

    Hi Erjan,

    I think that everything I said was total nonsense.
    Looks like the DB's I was working with weren't identical, one actually had a dot before the extension while the other one didn't, which would explain this :)

    However, I'm still experiencing some problems with the upload control.
    More times than not I get this error:

    [NullReferenceException: Object reference not set to an instance of an object.] 
       Telerik.Web.UI.RadUpload.IsValidExtension(UploadedFile file) +141 
       Telerik.Web.UI.RadUpload.IsValidUploadedFile(UploadedFile file, Boolean checkingFileSize, Boolean checkingFileExtension, Boolean checkingMimeType) +135 
       Telerik.Web.UI.RadUpload.ValidateUploadedFiles() +217 
       Telerik.Web.UI.RadUpload.OnLoad(EventArgs e) +13 
       System.Web.UI.Control.LoadRecursive() +47 
       System.Web.UI.Control.LoadRecursive() +131 
       System.Web.UI.Control.LoadRecursive() +131 
       System.Web.UI.Control.LoadRecursive() +131 
       System.Web.UI.Control.LoadRecursive() +131 
       System.Web.UI.Control.LoadRecursive() +131 
       System.Web.UI.Control.LoadRecursive() +131 
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1436 
     

    Which seems to be related to some embedded checking that I really have no use for. I do validate the type and size myself, so how can I get passed this point without using the built in checking?

    Regards,
    -DJ-
  5. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 23 Apr 2009 Link to this post

    Hi -DJ-,

    If you are validating the files by yourself you can just skip setting the AllowedFileExtensions property. Anyway you may have discovered a bug which we should reproduce and fix. Could you please give us more details about the case which is causing the NullReferenceException? Thanks.

    Regards,
    Albert
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  6. -DJ-
    -DJ- avatar
    263 posts
    Member since:
    Oct 2004

    Posted 23 Apr 2009 Link to this post

    Hi Albert,

    I will prepare a demo project and submit a support ticket, given that the problem will still be existing there. If not maybe I'll discover the reason for the error and post it here.

    Regards,
    -DJ-
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017