These forums are read-only and considered to be an archive. Please use the new Community for future interaction and posts.

javascript error "Gleamtech is undefined"

Love the control, I can run the examples just great. BUT, I can not get the control incorporated into my existing application. I have copied the web.config entries into the appropriate locations, placed the DLL in the bin folder and registered it in the GAC, put the FileUltimate folder in the appropriate location (or so I assume) in the root folder, and added the Register Page tag to the page I wanted the control on, and literally copied the example and changed the directories for the root folders.

When I load this page in IE, I get a nasty javascript error "Gleamtech is undefined" and in the page source you can see the javascript the control created. But when you view the page, the control only generates a link to this web site and you don't see the control with the files at all. I am not sure what I'm missing since I'm simply copying from the example project.

Any thoughts? We love this control and will license it if we can get it working in our existing site.


Steve 12/11/2012 6:08 AM
If the control is not rendered, it's usually because it can not load resources like JS and CSS files.
In the page source you should see 3 includes like this:

    <link href="/fileultimate/resource/634902470740000000/fileultimateresourcestore/combined.css" rel="stylesheet" />
    <script src="/fileultimate/resource/634902470740000000/fileultimateresourcestore/combined.js"></script>
    <script src="/fileultimate/resource/634902470740000000/fileultimateresourcestore/language-en.js" charset="utf-8"></script>

Please copy the url of combined.js and append it to the address of your web site and try to open it directly in the browser.
Let me know what error message you get.
Cem Alacayir 12/11/2012 8:06 AM
Thanks for the reply. When I view page source I do indeed see those three lines (the numbers vary):

<link href="/support/fileultimate/resource/634906015000976186/fileultimateresourcestore/combined.css" rel="stylesheet" />
<script src="/support/fileultimate/resource/634906015000976186/fileultimateresourcestore/combined.js"></script>
<script src="/support/fileultimate/resource/634906015000976186/fileultimateresourcestore/language-en.js" charset="utf-8"></script>

However if I append the location to the web server address I get a page not found returned. Is there an issue with running this using an application that sits below the root folder? In our case here, our company's web site is in the wwwroot, while the (future) filemanager pages sit under an application under the root folder (e.g. /SubFolder) so we placed the FileUltimate folder in /SubFolder/FileUltimate. The page the control is on renders, but where the control should be we just get this link displayed..."ASP.NET File Manager " and the url points to this web site.

We will continue searching.

Steve 12/12/2012 8:54 AM
Yes, it's a folder problem.

You say you put FileUltimate folder under /SubFolder but is /SubFolder an application in IIS?
If it's not an application the application root will be the web site root so FileUltimate folder should be under the web site root.

If you are not planning to make /SubFolder an application or move FileUltimate folder to the web site root,
then you can make FileUltimate find the correct path by adding the below setting in your project's web.config:

    <add key="FileUltimateBasePath" value="~/SubFolder/FileUltimate" />
Cem Alacayir 12/12/2012 9:43 AM
Thanks. I really appreciate the fast responses. Just not sure what we're missing. The relative paths seem correct - if we purposely put in bad values the system web page errors so it must be finding the locations. This is what is in the page source when you view:

<div id="fileManager-loader">
                    Copyright © 2006-2012 GleamTech
                <a href="" title="ASP.NET File Manager" class="gt-productlink">ASP.NET File Manager</a>
                <script type="text/javascript">
                    var fileManager = new GleamTech.JavaScript.UI.FileManager({
                        ElementID: "fileManager",
                        InstanceID: "7f73ee1f541794e662cf",
                        Language: "en",
                        ResourceUrl: "/support/fileultimate/resource/634906015000976186/fileultimateresourcestore/",
                        ActionUrl: "/support/fileultimate/filemanageraction/",
                        UploadMethod: "Flash",
                        ShowFoldersPane: true,
                        ShowOnLoad: true,
                        Width: "800px",
                        Height: "600px",
                        RootFolders: [["Resources", "131", "*", "0"]],
                        FileUploaderFormBasedHandlerUrl: "/support/fileultimate/fileuploaderformbased"

So it looks like the control is creating the content. But instead of displaying the file manager, we just get a static URL link back to this site. Not sure what else could be missing. When run through VS2010, you get the Gleamtech is undefined error in the javascript.

Again, this works perfectly in the standalone examples so I am confident everything else is fine. It's just in how we must be incorporating it into our existing winforms app.


Steve 12/12/2012 2:18 PM
Please pay attention.

You don't understand, it doesn't matter that you see

<div id="fileManager-loader">

in the page source. As long as, the JS file in the header is not loaded, the control can not be "rendered visually" because it depends on that JS file.

You said above:

"However if I append the location to the web server address I get a page not found returned"

and now you say "The relative paths seem correct". How did that happen all of a sudden?

I repeat:
What you need to do is to make this URL (replace web site address with yours) work:

Read my previous message to get that URL work correctly.
Cem Alacayir 12/12/2012 4:42 PM
OK. I simply started with a different site altogether and can confirm that the .js file is now accessible (I put in the URL and get prompted to download it) and the control displays. However, the issue now is that I get a 404 error when it tries to display the files in the folder I specified for RootFolder. I *know* the paths are correct because I placed an asp:label on the same page and used the filemanager.PhysicalPath and filemanager.Path properties to simply print them to the label's text (e.g. Label.Text = fileManager.PhysicalPath, etc etc) to rule out pathing problems. These locations *do* exist, are in the wwwroot subfolders and resolve in every other aspect of the site (e.g. css files, images, etc). This is very, very close and I realize this has been quite a lot of pestering to figure out pathing issues but I'm truly stumped now why I would get a 404 - Path Not Found popup over the control unless it is just doing something with paths that I can't see.

This will be my last question on the topic. I appreciate your advice and any final debugging tips. Your example project works flawlessly so something is just not configured properly.

Steve 12/13/2012 1:37 PM
Sorry, one more point to note. When I compare the page source of the working example, I see full file paths for 

ActionUrl: "/fileultimate/filemanageraction.ashx/" and
FileUploaderFormBasedHandlerUrl: "/fileultimate/fileuploaderformbased.ashx"

(note the .ashx).

When I view the page source of my (garbage) pages, my Url's do not have the extensions:

ResourceUrl: "/fileultimate/resource/634739086060000000/fileultimateresourcestore/"
FileUploaderFormBasedHandlerUrl: "/fileultimate/fileuploaderformbased"

I'm not sure if that is relevant of if that helps identify the issue.

Steve 12/13/2012 1:42 PM
Regarding .ashx it's used only when running on Visual Studio Web Server, IIS 6 and IIS 7+ classic mode.
IIS 7+ integrated mode supports extensionless URLs so there is no .ashx extension when running on this mode.

It may be possible that extensionless URLs do not work on your IIS (a missing fix or configuration).
Thus you may be getting the 404 error.
However you can force FileUltimate to use .ashx, by adding .ashx to "path" property of the handlers in FileUltimate\web.config file:

line 12
          <add name="ResourceHandler" verb="*" path="resource.ashx" ...
          <add name="FileManagerActionHandler" verb="*" path="filemanageraction.ashx"   .... 
          <add name="FileUploaderFormBasedHandler" verb="*" path="fileuploaderformbased.ashx" 

Let me know the result.
Cem Alacayir 12/13/2012 2:06 PM