I have created a small classic asp file that I indend to call form asp.net using the below. I works, but it feels wrong somehow:
Booking.BelongsToSite = file_get_contents("http://localhost:82/test2.asp?functionName=RetBTS¶m=" + User.ID);
protected string file_get_contents(string fileName)
{
string sContents = string.Empty;
if (fileName.ToLower().IndexOf("http:") > -1)
{ // URL
System.Net.WebClient wc = new System.Net.WebClient();
byte[] response = wc.DownloadData(fileName);
sContents = System.Text.Encoding.ASCII.GetString(response);
}
else
{
// Regular Filename
System.IO.StreamReader sr = new System.IO.StreamReader(fileName);
sContents = sr.ReadToEnd();
sr.Close();
}
return sContents;
}
Can anyone see any problems with doing this?
Also is it possible to do something like the below in Classic ASP / VB script. I can’t get it to call a dynamic function name:
dim functionName, param, result
functionName = request("functionName")
param = request("param")
result = functionName(param)
Also any idea how to parse the parameters. Say if I pass the parameters in the head like “1,2,3,4”, how can I pass the into the parenthesis?
Try to use
GetRefinstead ofEval.