Detecting if a there is a license file

Last post 09-24-2009, 11:15 AM by cutechat. 2 replies.
Sort Posts: Previous Next
  •  09-17-2009, 7:01 AM 55704

    Detecting if a there is a license file

    Hi,
    I have copied the license file AjaxUploader.lic in a sub-folder "AjaxUploader" of my web application, and written the following key in the web.config:
    <add key="AjaxUploaderLicense" value="AjaxUploader/AjaxUploader.lic" />
    and it works well.
     
    Now, if I delete the license file, I get an unhandled javascript exception after selecting the files and clicking "Open" in the browse dialog :
    " Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 500"
     
    Is there a way to detect from code behind (C#) if there is a valid license file?
    So that, in the case of the license file is not present, or if it has expired, then I can display a proper error message or use an alternate control.
     
    Thanks in advanced.
    Filed under:
  •  09-21-2009, 10:40 AM 55768 in reply to 55704

    Re: Detecting if a there is a license file

    CuteSoft people did not answer to that post, so I copy here the code I implemented in the case of someone would be interested:
     
    public bool AjaxUploaderLicenseFileExists()
    {
      // get the web application path
      string apppath = System.Web.HttpContext.Current.Server.MapPath(System.Web.HttpContext.Current.Request.ApplicationPath);
      // get the relative path of the AjaxUploader license file
      string licensefile = System.Configuration.ConfigurationManager.AppSettings["AjaxUploaderLicense"];
      if (string.IsNullOrEmpty(licensefile))
        licensefile = "bin\\AjaxUploader.lic";
      // check if the license file exists
      string licensepath = string.Format("{0}\\{1}", apppath, licensefile);
      return System.IO.File.Exists(licensepath);
    }
    Anyway, this method only allows me to check wether the license file exists or not, it does not tell me if it is valid (expired or not).
    I saw in the AjaxUploader developer guide (http://ajaxuploader.com/document/) that there is a UploaderLicenseProvider.GetLicense Method, but there is no explanation telling how to use it :(...
     
  •  09-24-2009, 11:15 AM 55851 in reply to 55768

    Re: Detecting if a there is a license file

    Hi,
     
    We do not provide any way to test the license.
     
    UploaderLicenseProvider class is just for DotNet framework , not for developer.
     
    Regards,
    Terry
     
View as RSS news feed in XML