Free Support Forum - groupdocs.com

IT is possible to set 'SetRootStoragePath' in aspx page in asp.net?


#1

Hi

I am use GroupDoc viewer in website in asp.net.Currently i heard about rotation function is enable in viewer,it very useful.

Here i explain my need.

I am create one website,in that user register and login any time,So based on userid i will create one temp folder

For E.x
if user ‘a’ login and it id is U001 and following is temp folder
C:\inetpub\wwwroot\website\UF\U001
if user ‘b’ login and it id is U002 and following is temp folder
C:\inetpub\wwwroot\website\UF\U002

Currently i am use this temp folder for store file and view using iframe(only pdf can view).GroupDoc view more than 50 format,so i try GroupDoc viewer.

What support team told me ,need to set 'SetRootStoragePath ’ in global.asax page in Application_Start method.So what happen here,all file store in same place and view to different user.But i cant delete this file once user logout.

So i try to create separate folder based on userid and i point to SetRootStoragePath to separate folder based on userid(above i mention folder).So i set SetRootStoragePath in aspx page,bcz i get user id in aspx page,so first i create that folder path

Dim viewPath As String = Server.MapPath(".") & "\UF"
Try
If Not Directory.Exists(viewPath) Then
Directory.CreateDirectory(viewPath)
End If
Catch ex As Exception
End Try

viewPath = viewPath & “” & Session(“userid”)
Try
If Not Directory.Exists(viewPath) Then
Directory.CreateDirectory(viewPath)
End If
Catch ex As Exception
End Try

Groupdocs.Web.UI.Viewer.SetRootStoragePath(viewPath)

So now filesave path is viewPath
like this

if user ‘a’ login
C:\inetpub\wwwroot\website\UF\U001

if user ‘b’ login
C:\inetpub\wwwroot\website\UF\U002

Finally file save in separate folder and gropdoc viewer create temp,processing,cache folder and png,js file.Once user logout i can delete folder based on userid who log out.

But what i face,one time can view ,next time cant view,it show path error.

Server Error in ‘/webFT_LoadMore’ Application.

Value cannot be null.
Parameter name: path2

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.ArgumentNullException: Value cannot be null.
Parameter name: path2

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[ArgumentNullException: Value cannot be null.
Parameter name: path2]
System.IO.Path.Combine(String path1, String path2) +10654049
..(String filePath, Func2 htmlWithImageCreator, String prefixForResourceUrlsInHtml, String prefixForResourceUrlsInHtmlFiles, Nullable1 firstPageParam, Nullable`1 pageCountParam, Boolean usePngImagesForHtmlBasedEngine, Boolean convertWordDocumentsCompletely, Boolean ignoreDocumentAbsence) +395
Groupdocs.Web.UI.Handlers.ViewDocumentHandler.ProcessRequest(HttpContext context) +2747
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +341
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +69


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18056

Regards
Aravind


#2

Hello Aravind,

We are sorry to hear that you have such issue. We checked your usecase and found out that the logic is correct but at this time GroupDocs.Viewer library doesn’t support different paths for SetRootStoragePath method.

Also we have a good news for you – we will add this feature to the GroupDocs.Viewer library 2.4 version.

If you will have more questions please feel free to contact us.