M
Michael Vanhoutte
We have an ASP.NET website written in C# that accesses a
VB6 COM component. That component accesses the ASP-objects
in the following manner:
Set objContext = GetObjectContext
Set objRequest = objContext("Request")
strAddress = objRequest.ServerVariables("REMOTE_ADDR")
Set objContext = Nothing
Set objRequest = Nothing
On all the pages of our website the ASPCompAt-property is
set to True. We have pages in our website though where
GetObjectContext returns Nothing and others where it
returns an object.
For example, page 1 in the our ASP.NET website has
ASPCCompAt set to True and can successfully access the ASP
Request-object.
Page 2 also has the ASPCompAt-property set to True, but
the GetObjectContext-function returns Nothing (Null)
there. We've spend a significant amount of time trying to
find the difference between these two pages and the only
difference that we saw was that a Server.Transfer-call is
done before we call GetObjectContext on page 1.
As soon as we also did a Server.Transfer in page 2, the
GetObjectContext function returned a valid object.
For example:
private void Page_Load(object sender, System.EventArgs e)
{
// Doing a Server.Transfer if GetObjectContext
// returns Nothing. This is only done once
if (ourVB6Component.GetObjectContext2() == null) {
Server.Transfer("page2.aspx");
}
// The following method calls GetObjectContext internally
// and only works if a Server.Transfer is first called.
ourVB6Component.DoMethod;
}
Can anybody explain why GetObjectContext would behave
differently after a Server.Transfer? Is there a clean way
to get GetObjectContext to work correctly at all times?
VB6 COM component. That component accesses the ASP-objects
in the following manner:
Set objContext = GetObjectContext
Set objRequest = objContext("Request")
strAddress = objRequest.ServerVariables("REMOTE_ADDR")
Set objContext = Nothing
Set objRequest = Nothing
On all the pages of our website the ASPCompAt-property is
set to True. We have pages in our website though where
GetObjectContext returns Nothing and others where it
returns an object.
For example, page 1 in the our ASP.NET website has
ASPCCompAt set to True and can successfully access the ASP
Request-object.
Page 2 also has the ASPCompAt-property set to True, but
the GetObjectContext-function returns Nothing (Null)
there. We've spend a significant amount of time trying to
find the difference between these two pages and the only
difference that we saw was that a Server.Transfer-call is
done before we call GetObjectContext on page 1.
As soon as we also did a Server.Transfer in page 2, the
GetObjectContext function returned a valid object.
For example:
private void Page_Load(object sender, System.EventArgs e)
{
// Doing a Server.Transfer if GetObjectContext
// returns Nothing. This is only done once
if (ourVB6Component.GetObjectContext2() == null) {
Server.Transfer("page2.aspx");
}
// The following method calls GetObjectContext internally
// and only works if a Server.Transfer is first called.
ourVB6Component.DoMethod;
}
Can anybody explain why GetObjectContext would behave
differently after a Server.Transfer? Is there a clean way
to get GetObjectContext to work correctly at all times?