This is a migrated thread and some comments may be shown as answers.

RadAsyncUpload Issue with Forms Authentication using roles

6 Answers 180 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
Alejandro
Top achievements
Rank 1
Alejandro asked on 17 Apr 2013, 06:13 PM
Hi,
I am using RadAsyncUpload (Q2 2012 SP1) with Forms Authentication using roles, it works well on my localhost, but when i deploy the site to my production server when i try to upload a file it simply doesn't work on submitting, i was debugging using  Firebug with Chrome and Firefox and this is what i get on the error console:
Sys.WebForms.PageRequestManagerServerErrorException: Sys.WebForms.PageRequestManagerServerErrorException: 
An unknown error occurred while processing the request on the server. The status code returned from the
server was: 401

And in the script tab from firebug i get the next values: 0|error|401||.

I also followed the suggest from the telerik help thread: http://www.telerik.com/help/aspnet-ajax/asyncupload-troubleshooting.html,
where explains about making changes in the web.config for allowing telerik controles have authorization,
separated from the forms authentication but it still not working.
This is an example of how i have one of my configuration files for one role:

<?xmlversion="1.0"?>

<configuration>

<system.web>

<authorization>

<!—-->

<allowroles="Alumno"/>

<denyusers="*"/>

</authorization>

</system.web>

<locationpath="Telerik.Web.UI.WebResource.axd">

<system.web>

<authorization>

<allowusers="*" />

</authorization>

</system.web>

</location>

</configuration>

The control declaration in my aspx file looks like this:

<telerik:RadAsyncUploadrunat="server"ID="T_uploadArchivo"MaxFileInputsCount="1"AllowedFileExtensions="doc,docx"

onfileuploaded="T_uploadArchivo_FileUploaded"TemporaryFolder="~/Inicio/Alumno/Temporal">

<FileFilters>

<telerik:FileFilterDescription="Documentos de Procesador de textos(*.doc y *.docx)"Extensions="doc,docx"/>

</FileFilters>

</telerik:RadAsyncUpload>

The temporary folder is inside the same folder where authenticated user is, and i move the file manually to the Final Destination.

I also have tried some other solutions posted on the forums but nothing seems to work, i hope someone could help me solve this, thanks.


6 Answers, 1 is accepted

Sort by
0
Genady Sergeev
Telerik team
answered on 19 Apr 2013, 07:34 AM
Hi Alejandro,

Have you tried to enable anonymous authentication in IIS? It might be that you are running under the flash module, which is not capable of working in authenticated environment unless anonymous auth. is enabled and the web.config location tag is added.

All the best,
Genady Sergeev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Alejandro
Top achievements
Rank 1
answered on 19 Apr 2013, 04:57 PM
Thanks Sergeeev, i have tried this solution before, i'll attach an image of how th authentication configuration looks in IIS in for my website, and i also have tried to disable the flash and silverlight module using the javascript code i've found on another forum thread to see how it works but still getting the same results.
The web.config file from one of the roles i'm using looks like this:

<?xml version="1.0"?>
<configuration>
    <system.web>
      <authorization>
        <!-- Order and case are important below -->
        <allow roles="Administrador"/>
        <deny users="*"/>
      </authorization>
    </system.web>
    <location path="~/Telerik.Web.UI.WebResource.axd">
      <system.web>
        <authorization>
          <allow users="*" />
        </authorization>
      </system.web>
    </location>
</configuration>

Where you can see the location path is ok i guess, is there any other solution i can try to solve this issue?
0
Peter Filipov
Telerik team
answered on 23 Apr 2013, 07:44 AM
Hello Alejandro,

Could you please clarify when the error occurs? When you select a file or when the page is submitted after a file is uploaded. If it is the second case try to comment your custom logic and test the application. That is how we are going to determine from where the issue origins.

Kind regards,
Peter Filipov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Alejandro
Top achievements
Rank 1
answered on 23 Apr 2013, 05:15 PM
Thanks Peter, the error occurs when i submit the form, i have tried the control in a new test website witohout all the custom logic and also without forms authentication which is what i think causes the error but it wasn't like that, i first uploaded the page to my production server leaving  the control without assigning a target folder like you can see in the next Code Block:

<form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>
    <div>
        <telerik:RadAsyncUpload runat="server" ID="T_uploadArchivo" >
        </telerik:RadAsyncUpload>
    <asp:Button ID="Button1" runat="server" Text="Button" />
    </div>
    </form>


And it worked, but when i set a Target Folder i get a server error:
Access to the path is denied.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
 
Exception Details: System.UnauthorizedAccessException: Access to the path is denied.
 
ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6 and IIS 7, and the configured application pool identity on IIS 7.5) that is used if the application is not impersonating. If the application is impersonating via <identity impersonate="true"/>, the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user.
 
To grant ASP.NET access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.

I think the error is when the file is moved from the temporary folder to the target folder but i don't know what is the reason.


0
Peter Filipov
Telerik team
answered on 24 Apr 2013, 07:03 AM
Hi Alejandro,

When TargetFolder is set the RadAsyncUpload moves the uploaded files from the TemporaryFolder to the TargetFolder on postback. From the provided error description it seems that you do not have access (permissions) to the target folder. Here is a description how those permissions could be set:
To grant ASP.NET access to a folder, right-click on the folder, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Check the box for full control.

Regards,
Peter Filipov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Alejandro
Top achievements
Rank 1
answered on 24 Apr 2013, 11:36 PM
Thanks Peter,
Finally i got the solution for the issue, it was the permissions for the Target Folder as you told me, the problem was i had made the changes on the permissions by the panel from my web server and i was assuming the panel change the permissions as i needed but it didn't. After changing manually the permissions in the folders on the server i finally got it right and the RadAsyncUpload works perfect.
Best Regards.
Tags
AsyncUpload
Asked by
Alejandro
Top achievements
Rank 1
Answers by
Genady Sergeev
Telerik team
Alejandro
Top achievements
Rank 1
Peter Filipov
Telerik team
Share this question
or