Webservice File.Exist
NoiK00
Member Posts: 51
Hi all,
When running a webservices and trying to open a file i get the error "Access Denied".
Here's the things i tried:
- Local paths works(see the tried paths and results in the code);
- I've already checked the permissions, looked fine;
- I've logged in using the same user on the server and tried to acces the file myself, it worked;
- Tested if it was a long path name, small path names also didn't work;
- Tried working with absolute pathnames, no difference;
- As an alternative i tried to just open the file instead of checking if it exists, with no result.
This is the used code:
Any suggestions on what to do to get it working?
Thanx,
NoiK
EDIT: the server is running the servicetier AND SQL database
AND the user is a domain admin account
When running a webservices and trying to open a file i get the error "Access Denied".
Here's the things i tried:
- Local paths works(see the tried paths and results in the code);
- I've already checked the permissions, looked fine;
- I've logged in using the same user on the server and tried to acces the file myself, it worked;
- Tested if it was a long path name, small path names also didn't work;
- Tried working with absolute pathnames, no difference;
- As an alternative i tried to just open the file instead of checking if it exists, with no result.
This is the used code:
GetProductImage(productid : Code[10];VAR data : BigText)
IF NOT (productid = '') THEN
IF (item.GET(productid) AND (item."Picture Name" <> '')) THEN
BEGIN
//Get default settings
RecSalesSetup.GET;
RecSalesSetup.TESTFIELD("Path Item Pictures-WEB");
test := USERID;
IF test = '' THEN
ERROR('Ghost user!');
// LocTxtPicture := '\\server07\c$\75000 (Custom).jpg'; //Joy, local
// LocTxtPicture := 'c:\75000 (Custom).jpg'; //joy, local
// LocTxtPicture := RecSalesSetup."Path Item Pictures-WEB" + item."Picture Name" + '.jpg'; //No joy
LocTxtPicture := '\\server04\data\itemadministration\Web\75000 (Custom).jpg'; //No joy
// LocTxtPicture := '\\172.19.1.203\data\itemadministration\Web\75000 (Custom).jpg'; //No joy
// LocTxtPicture := '\\172.19.1.203\data\itemadministration\75000 (Custom).jpg'; //No joy
// LocTxtPicture := '\\172.19.1.203\data\75000 (Custom).jpg'; //No joy
FileHelper2 := FileHelper2.FileInfo(LocTxtPicture); //'mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.IO.FileInfo
FileMode := 4;
FileHelper.Open(LocTxtPicture, FileMode); //'mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.IO.File
IF (FileHelper.ToString()) <> '' THEN
//FileHelper2.Exists THEN //FileHelper.Exists(LocTxtPicture) THEN//AND FileHelper2.Exists THEN
BEGIN
picture.CREATEINSTREAM(IStream);
picture.OPEN(LocTxtPicture);
IF picture.LEN > 0 THEN picture.CREATEINSTREAM(IStream);
MemoryStream := MemoryStream.MemoryStream();
COPYSTREAM(MemoryStream, IStream);
Bytes := MemoryStream.GetBuffer();
data.ADDTEXT(Convert.ToBase64String(Bytes));
picture.CLOSE;
END
ELSE
ERROR('File Not Found');
END
ELSE
ERROR('No File')
ELSE
ERROR('No ID');
Any suggestions on what to do to get it working?
Thanx,
NoiK
EDIT: the server is running the servicetier AND SQL database
AND the user is a domain admin account
0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 331 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions