|
 |
aspx thread: The system.web namespace - quick one!
Message #1 by "Anders Lundholm" <lundholm@s...> on Tue, 7 Nov 2000 17:10:08 +0100
|
|
A quick question!
I get a compiler error with the following text:
"No overload for method 'HttpServerUtility' takes '0' arguments2"
It's the "HttpServerUtility myUtil = new HttpServerUtility();" which fails!
I've tried like 1000 different approaches without luck. Anyone?
Basically, I'd like to use a server.execute function to get the content of
another page - then transfer back control to the original page.
<% @Page Language="C#" %>
<% @Assembly Name="System.Net" %>
<% @Import Namespace="System.Web" %>
<% @Import Namespace="System.Data" %>
<% @Import Namespace="System.Text" %>
<% @Import Namespace="System.IO" %>
<% @Import Namespace="System.Net.Sockets" %>
<% @Import Namespace="sphereworx.db" %>
<%
HttpServerUtility myUtil = new HttpServerUtility();
myUtil.Execute("index.asp");
%>
with regards
anders lundholm · lundholm@s...
the sphereworx / monoliner experience
--
Message #2 by "Fredrik Normen" <fredrik.normen@e...> on Wed, 08 Nov 2000 09:57:05 +0100
|
|
Hi=2C
If you look at the HttpServerUtility it need to have the context of the
page as an argument=2E
HttpServerUtility(class System=2EWeb=2EHttpContext context)
(Someone corret me if I=27m wrong now)
We can get the current context by calling the =22current=22 method of the
HTTPContext object=2E If we want to create our own context from the
begining=2C we have to create a new context=2E
Before we can create a context we have to create new HTTPRequest and
HTTPResponse objects=2E
To create a new HTTPRequest object we have to pass three parameters=2E
The name of the asp+ file=2C the url and the querystring=2E
To create a new HTTPRepsonse object we have to pass a TextWriter object
We need the TextWriter object to enabling custom output to the outgoing
HTTP content body=2E The HTTPContext object need two parameters (
HTTPRequest=2CHTTPResponse ) After this we have created a Context=2E
The HTTPServerUtitlity need this context as an argument=2E
I don=27t think we can create an object from the HTTPServerUtitlity
because it=27s in a protected level=2E
So MS have given us the Server object to work with=2E
I think the Server object is created when the code is compiled=2E
The Server object is created from the HttpServerUtitlity class with the
context of the executed page=2E
(Hmm=2C this is what I think=2C so if someone realy know how it works
please contact me=2E=2E)
You can simply write=3A
Server=2EExecute(=22index=2Easp=22)
This will work=3A
------
=3C=25 =40Page Language=3D=22C=23=22 =25=3E
=3C=25
Server=2EExecute(=22connection=2Easpx=22)=3B
=25=3E
hello
-----
/Fredrik Normen
----- Original Message -----
From=3A =22Anders Lundholm=22 =3Clundholm=40sphereworx=2Ecom=3E
Date=3A Tuesday=2C November 7=2C 2000 5=3A10 pm
Subject=3A =5Baspx=5D The system=2Eweb namespace - quick one!
=3E A quick question!
=3E I get a compiler error with the following text=3A
=3E
=3E =22No overload for method =27HttpServerUtility=27 takes =270=27 argum
ents2=22
=3E It=27s the =22HttpServerUtility myUtil =3D new HttpServerUtility()=3B
=22
=3E which fails!
=3E I=27ve tried like 1000 different approaches without luck=2E Anyone=3F
=3E
=3E Basically=2C I=27d like to use a server=2Eexecute function to get the
=3E content of
=3E another page - then transfer back control to the original page=2E
=3E
=3E =3C=25 =40Page Language=3D=22C=23=22 =25=3E
=3E =3C=25 =40Assembly Name=3D=22System=2ENet=22 =25=3E
=3E =3C=25 =40Import Namespace=3D=22System=2EWeb=22 =25=3E
=3E =3C=25 =40Import Namespace=3D=22System=2EData=22 =25=3E
=3E =3C=25 =40Import Namespace=3D=22System=2EText=22 =25=3E
=3E =3C=25 =40Import Namespace=3D=22System=2EIO=22 =25=3E
=3E =3C=25 =40Import Namespace=3D=22System=2ENet=2ESockets=22 =25=3E
=3E =3C=25 =40Import Namespace=3D=22sphereworx=2Edb=22 =25=3E
=3E
=3E =3C=25
=3E HttpServerUtility myUtil =3D new HttpServerUtility()=3B
=3E myUtil=2EExecute(=22index=2Easp=22)=3B
=3E =25=3E
=3E
=3E with regards
=3E anders lundholm =B7 lundholm=40sphereworx=2Ecom
=3E the sphereworx / monoliner experience
|
|
 |