Click here to Skip to main content
15,879,047 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SbsSW.SwiPlCs;
using System.IO;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

        StreamReader myFile = new StreamReader("C:\\TS.pl");
        string myString = myFile.ReadToEnd();
        myFile.Close();

        Environment.SetEnvironmentVariable("SWI_HOME_DIR", @"C:\\Program Files\SWI-Prolog\boot32.prc");//@"the_PATH_to_boot32.prc");

        if (!PlEngine.IsInitialized)
        {
            SbsSW.SwiPlCs.PlEngine.Initialize(new String[] { "-q", "-f", myString });
        }
    }
}



can someone tell me where is my fault
i'm trying to connect a swi-prolog with asp.net, and every-time i fail.
this is my last problem
http://dl.dropbox.com/u/28084245/asp.jpg[^]

please if anyone know the solution or know a way that i can build a Prolog with ASP.NET.
send me at "ms_almouhtasb@hotmail.com".
Posted
Updated 20-May-16 4:14am
Comments
Sergey Alexandrovich Kryukov 10-May-12 14:50pm    
Do you understand that what are you trying to do happens on each HTTP request? I does not make sense. Rather, you should create some service, initialize Prolog environment once and then communicate between this service and HTTP server through your server-side code.
--SA
Mhd Sami Almouhtasb 10-May-12 14:55pm    
it make sense, look i'm trying to make a game with rules, i have some rules in the "TS.pl", i replace the database rules with a prolog code to check some stuff.
Mhd Sami Almouhtasb 10-May-12 14:56pm    
man if you have a solution tell me, please my project depend on this.

 
Share this answer
 
Comments
codeBegin 6-Jun-12 23:58pm    
my 5
I think you must initialize engine with a filename in -f parameter and not with a string of Prolog code.
SbsSW.SwiPlCs.PlEngine.Initialize(new String[] { "-q", "-f", "C:\\TS.pl" });
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900