Specify the path where GridWeb stores temporary files
about file cache
When GridWeb session mode is ViewState, it stores its temporary session files inside the Application Base Directory. Sometimes, it is not OK to store temporary session files there because Application Base Directory might not have write permissions on it. In such cases, GridWeb throws such an exception
[UnauthorizedAccessException: Access to
the path 'D:</span>inetpub</span>wwwroot</span>AsposeExcelTest</span>gwb_tempGridWeb1' is denied.]
The solution to above problem is to give write access to Application Base Directory or change the GridWeb temporary session files path having write access using the GridWeb.SessionStorePath property. This path should be relative to Application Base Directory.
Specify the path where GridWeb stores temporary session files
The following sample code specifies the path where GridWeb stores temporary session files.
about picture cache
when there are shapes/pictures in the worksheet,GridWeb will save all the shape/pictures to a cache path
the default cache path is System.Web.HttpContext.Current.Server.MapPath("/acwcache")
also we can use GridWeb.PictureCachePath to set this path to specific path.
when we open a page GridWeb will resolve the request image url,and get the image stream from the cache by the url id.
for example ,if your page address is http://ip/mygridwebapp/test.aspx
the image request url generated by GridWeb will be http://ip/mygridwebapp/test.aspx/acw_image/imageid.
sometimes the shapes/pictures are not loaded when you use Friendly Url.
you need to check the image url request.
the normal image request shall be like: http://ip/mygridwebapp/test.aspx/acw_image/imageid
but your request go like this :http://ip/mygridwebapp/test/acw_image/imageid
if you use FriendlyUrl you need to filter out the image url request for GridWeb.
thus GridWeb control server can get and resolve the request and find the image stream from the cache path.
for example we assume your page url like this:http://ip/mygridwebapp/test.aspx
then the below code is a workaround to fix such issue.
//write your custom url resolver:MyWebFormsFriendlyUrlResolver
public class MyWebFormsFriendlyUrlResolver : WebFormsFriendlyUrlResolver
{
public MyWebFormsFriendlyUrlResolver() { }
public override string ConvertToFriendlyUrl(string path)
{
if (!string.IsNullOrEmpty(path))
{//filter your GridWeb related page,here we use 'mygridwebapp' to identify as we assume your page is:http://ip/mygridwebapp/test.aspx
if (path.ToLower().Contains("mygridwebapp"))
{ // Here the filter code
return path;
}
}
return base.ConvertToFriendlyUrl(path);
}
}
//in RoutConfig.cs set the custom url resolver:MyWebFormsFriendlyUrlResolver
public static class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
var settings = new FriendlyUrlSettings();
settings.AutoRedirectMode = RedirectMode.Permanent;
routes.EnableFriendlyUrls(settings, new IFriendlyUrlResolver[] {
new MyWebFormsFriendlyUrlResolver() });
}
}