Hello,
according to Microsoft the Syntax of webrequest should be:
var req: System.Net.WebRequest := System.Net.WebRequest.Create(URL: String);
If doing so in a new Project (from your web template in VS2017) i get Error <Cannot instantiate abstract class “WebRequest”>
If opening my Project Directory from former VS2015 and Oxygen v9.3.xxx in VS2017, there is no Compiler error at the same Code file in VS2017. and the whole (huge) Project works fine.
the lines are within a class method:
class method globalfuncs.isHor(Img: System.String): System.Boolean;
begin
var Im: System.Drawing.Image;
try
if System.Environment.MachineName.ToUpper.StartsWith(‘XXX’) then
begin
var req: System.Net.WebRequest := System.Net.WebRequest.Create(globalvar.ImageURL + Img);
var res: System.Net.WebResponse := req.GetResponse;
var st: System.IO.Stream := res.GetResponseStream;
Im := System.Drawing.Image.FromStream(st);
end else
Im := System.Drawing.Image.FromFile(globalvar.ImagePath + Img);
var ImgW: System.Single := Im.PhysicalDimension.Width;
var ImgH: System.Single := Im.PhysicalDimension.Height;
if ImgH > ImgW then Result := False else Result := True;
Im.Dispose;
except
if Im <> nil then Im.Dispose;
Result := False;
end;
end;
Do you have any ideas?
There is another strange behavior might bring an idea:
if opening old Directory with the web application in VS2017, the files *.aspx and *.aspx.pas are not grouped any more, the Debugger does not work propperly, the CC does not work and moving mouse over objects like WebRequest shows “unknown type”, but application compiles and works without Problems.
if creating a new Project from your templates in VS2017, the files are grouped, the Debugger works, the CC works and all objects are wellknown. I copied about 8000 lines of my Code in this new Project and all works but only WebRequest does not as described above.
I tried a few hours but found no idea for a solution.
Can you help me?
best regards
Hans