Jump to content


  • Posts

  • Joined

  • Last visited

gendelf's Achievements


Newbie (1/7)



  1. Hi Vinphetamin,The code from the aspx page is :<%@ Page Language="vb" AutoEventWireup="false" Codebehind="FunctionsNew.aspx.vb" Inherits="iipdmweb.FunctionsNew"%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML><HEAD><title>FunctionsNew</title><meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1"><meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1"><meta name="vs_defaultClientScript" content="JavaScript"><meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5"></HEAD><body MS_POSITIONING="GridLayout"><form id="Form1" method="post" runat="server"></form></body></HTML>The code from the VB code-behind page is :Imports SystemImports System.WebImports System.Xml.SerializationImports System.NetImports System.IOPublic Class FunctionsNew Inherits System.Web.UI.Page#Region " Web Form Designer Generated Code "'This call is required by the Web Form Designer.<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() End Sub 'NOTE: The following placeholder declaration is required by the Web Form Designer. 'Do not delete or move it. Private designerPlaceholderDeclaration As System.Object Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init 'CODEGEN: This method call is required by the Web Form Designer 'Do not modify it using the code editor. InitializeComponent() End Sub#End RegionPrivate Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'Put user code to initialize the page here End Sub'***************************************************************** 'This Funtion send a request to a server defined by the Url parameter, 'and returns a string that is the response of the server (the HTML that 'the server send as the response to a browser request). 'Input: url - the url of the server'***************************************************************** Public Function GetWebPageResult(ByVal url As String) As String Dim myHttpWebRequest As HttpWebRequest = _ CType(WebRequest.Create(url), HttpWebRequest) Dim myHttpWebResponse As HttpWebResponse = _ CType(myHttpWebRequest.GetResponse(), HttpWebResponse) Dim receiveStream As Stream = myHttpWebResponse.GetResponseStream() Dim encode As System.Text.Encoding = System.Text.Encoding.GetEncoding("utf-8") Dim readStream As New StreamReader(receiveStream, encode) GetWebPageResult = readStream.ReadToEnd() End Function '***************************************************************** 'This Funtion call a remote aspx script that updates the department 'database after actions the students and the experimenter do. ' Input : ' 1. the action (registration, canceling ...). ' 2. sid - the subject's ID ' 3. exp_name - the experiment name ' 4. credit - the amount of credit that was given 'Output: a string. if no error occurred during the call to the remote script ' then the string is empty. else, the string contains the error message. '***************************************************************** Public Function UpdateDep(ByVal action As String, ByVal sid As Integer, _ ByVal exp_name As String, ByVal credit As Integer) As String Dim strMsg As String Dim url As String Dim act_num As Integer If action = "Register" Then act_num = 1 ElseIf action = "Cancel" Then act_num = 2 ElseIf action = "Credit" Then act_num = 3 End If strMsg = "" url = "http://localhost/ConnDBParam/ConnDBParam.aspx" & _ "?action=" & act_num & ",sid=" & sid & ",exp_name=" & exp_name & _ ",credit=" & credit Try strMsg = GetWebPageResult(url) Catch ex As Exception strMsg = ex.Message End Try UpdateDep = strMsg End FunctionEnd ClassGendelf
  2. Hi there.I'm trying to call a function that resides in the code of an asp.net page,from a classic asp page.When I tried to include the asp.net file in the asp file (as I used to in classic asp),I got the error : "Active Server Pages, ASP 0140 (0x80004005)The @ command must be the first command within the Active Server Page".I understand now that I can not just include the asp.net file in the asp file,but how can I call a function that is written in asp.net ?I would appreciate your help.
  • Create New...