Unable to connect to backend!!!

Jan 24, 2013 at 2:07 PM

Hi there,

I have been trying to connect to a folder in my solution using framework 4.0 (i have followed instructions), but i am getting the famous message "Unable to connect to backend".

This is my webconfig:

<configuration>
	<configSections>
		<section name="elFinder" type="elFinder.Connector.Config.AppConnectorConfig, elFinder.Connector" requirePermission="false" />
	</configSections>

	<elFinder apiVersion="2.0"
		localFSRootDirectoryPath="C:\inetpub\wwwroot\Intranet\assets"
		localFSThumbsDirectoryPath="C:\inetpub\wwwroot\Intranet\assets"
		rootDirectoryName="Root"
		uploadMaxSize="20M"
		defaultVolumeName="LocalFileSystem"
		baseUrl="http://jetons-hp:2030/assets/"
		baseThumbsUrl="http://jetons-hp:2030/assets/"
		duplicateFilePattern="Copy of {0}"
		duplicateDirectoryPattern="Copy of {0}"
		thumbsSize="48,48">
	</elFinder>
	<location path="assets">
		<system.web>
			<authorization>
				<allow users="*"  />
			</authorization>
		</system.web>
	</location>
	<system.web>
		<customErrors mode="Off" />
		<compilation debug="true" targetFramework="4.0">
			<assemblies>
				<add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
				<add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
				<add assembly="System.Speech, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
			</assemblies>
		</compilation>
		<authentication mode="Windows">
			<!--<forms loginUrl="~/Account/Login.aspx" timeout="2880"/>-->
		</authentication>
		<membership>
			<providers>
				<clear />
				<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" />
			</providers>
		</membership>
		<profile>
			<providers>
				<clear />
				<add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/" />
			</providers>
		</profile>
		<roleManager enabled="false">
			<providers>
				<clear />
				<add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/" />
				<add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/" />
			</providers>
		</roleManager>
		<httpHandlers>
			<add verb="*" path="elfinder.connector" type="elFinder.Connector.Connector, elFinder.Connector"/>
		</httpHandlers>
		<httpModules />
	</system.web>
	<system.webServer>
		<validation validateIntegratedModeConfiguration="false"/>
		<modules runAllManagedModulesForAllRequests="true" />
		<handlers>
			<add name="elfinder" path="elfinder.connector" type="elFinder.Connector.Connector, elFinder.Connector" verb="*" />
		</handlers>
	</system.webServer>
</configuration>

This is my code in the page:

 <script type="text/javascript" charset="utf-8">
        $(function () {
            $('.fileManager').elfinder({
                url: '@Url.Content("~/elfinder.connector")',
                height: 600
            });
        });
</script>
    <div class="fileManager">finder</div>  

When i execute the connector in the adderss bar (http://jetons-hp:2030/elfinder.connector), I am getting the following error:

{ "error": "Command not set" }

Could you help me see what could I have possibly forget?

Thanks in advance,

Jeton

Coordinator
Jan 25, 2013 at 8:13 AM

Basically your configuration looks ok. And the fact, that you get the response from http://jetons-hp:2030/elfinder.connector suggests that HttpHandler is correctly configured. I'm guessing that problem is somewhere in the html/js or authentication. Could you verify that generated url in:

 

<script type="text/javascript" charset="utf-8">
        $(function () {
            $('.fileManager').elfinder({
                url: '@Url.Content("~/elfinder.connector")',
                height: 600
            });
        });
</script>

is exactly the same as http://jetons-hp:2030/elfinder.connector? Also did you check what request is being made and which server error occurs in some developer's tool (personally I like Chrome's dev tools the best)?

You have configured "Windows Authentication" in a web.config - could you check what happens if you change it to "Forms authentication"?

 

Jan 25, 2013 at 9:06 AM

Hi there,

Thnx for reply.

I have checked the code using Chrome Dev Tools, and also made the change from Windows to Forms Auth. but not success. I have followed everything as instructed.

If it helps, this is my html code:

<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeBehind="Default.aspx.cs" Inherits="WebApplication2._Default" %>

<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
    <link href="elfinder-2.0/css/elfinder.min.css" rel="stylesheet" type="text/css" />
    <link href="elfinder-2.0/css/jquery.ui.all.css" rel="stylesheet" type="text/css" />
    <link href="elfinder-2.0/css/theme.css" rel="stylesheet" type="text/css" />.
    <script src="elfinder-2.0/js/jquery-1.8.3.min.js" type="text/javascript"></script>
    <script src="elfinder-2.0/js/jquery-ui-1.9.2.min.js" type="text/javascript"></script>
    <script src="elfinder-2.0/js/elfinder.min.js" type="text/javascript"></script>
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    <script type="text/javascript" charset="utf-8">
        $(function () {
            $('.fileManager').elfinder({
                url: '@Url.Content("~/elfinder.connector")',
                height: 600
            });
        });
    </script>
    <div class="fileManager">finder</div> 
</asp:Content>
Thnx again for your help ;)

Coordinator
Jan 25, 2013 at 9:41 AM
jetonsiqeca wrote:

I have checked the code using Chrome Dev Tools, and also made the change from Windows to Forms Auth. but not success. I have followed everything as instructed.

 

Ok, then what is the exact error you are seeing in dev tools (click "Network" tab then find failed request)? Please be more specific!

Jan 25, 2013 at 9:47 AM

I ma sorry man, i forgot to attach the error I am getting in the Network tab. The link in red is this:

http://localhost:59236/@Url.Content(%22~/elfinder.connector%22)?cmd=open&target=&init=true&tree=true&_=1359107042671

Error is 404 Not Found. 

Coordinator
Jan 25, 2013 at 9:52 AM

Ok, I don't know how I missed it earlier, but you are using ASPX view engine or just WebForms, so you can't use @Url.Content(...) because this structure exists only in Razor view engine. Instead just type:

<script type="text/javascript" charset="utf-8">
        $(function () {
            $('.fileManager').elfinder({
                url: '/elfinder.connector',
                height: 600
            });
        });
    </script>

Jan 25, 2013 at 12:42 PM

Gosh, I have tried all variations except this one with '/'. I feed so stupid.

Thanks anyways for your time.