pass an ASP HTTP Request/Session Object to C#?

D

Daniel Schwab

Hi

I have a C# component which needs to be accessed from ASP-Pages (not .net,
old-style-asp).
I cannot convert the asp pages to aspx pages at this time! They need to
remain in ASP for a while.

I wrote the component according to the guide from
http://www.codeproject.com/dotnet/nettocom.asp

it works, i can pass ints & strings from ASP to C# and backwards

But i cannot pass the session- and the request-object from ASP to the C#
Component.
According to MS the Object is not longer a Collection but a
NameValueCollection
(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/Dnaspp/htm
l/aspnetmigrissues.asp?frame=true#aspnetmigrissues_state)

so, now my questions:

1) Is there any way/workaround/converter (??) to pass an Request and a
Session Object from
an old style ASP Page to an C# Component? how should that work?

2) is my approach (so far) right for what i want to do?

3) any other ideas to solve my problem? ;-)

thanks & bye
daniel
 
G

Guest

Daniel,

How are you passing in the ASP session?

Nick.

----- Daniel Schwab wrote: -----

Hi

I have a C# component which needs to be accessed from ASP-Pages (not .net,
old-style-asp).
I cannot convert the asp pages to aspx pages at this time! They need to
remain in ASP for a while.

I wrote the component according to the guide from
http://www.codeproject.com/dotnet/nettocom.asp

it works, i can pass ints & strings from ASP to C# and backwards

But i cannot pass the session- and the request-object from ASP to the C#
Component.
According to MS the Object is not longer a Collection but a
NameValueCollection
(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/Dnaspp/htm
l/aspnetmigrissues.asp?frame=true#aspnetmigrissues_state)

so, now my questions:

1) Is there any way/workaround/converter (??) to pass an Request and a
Session Object from
an old style ASP Page to an C# Component? how should that work?

2) is my approach (so far) right for what i want to do?

3) any other ideas to solve my problem? ;-)

thanks & bye
daniel
 
D

Daniel Schwab

Hi Nick
How are you passing in the ASP session?

As far as i am i cannot pass the ASP session, i can only pass

ints or strings.

here's my code (only snipplets):

----------------------

------------in c# -----------------------

[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]

public interface _Serviceproxy

{

void initRequest2(string cmd);

void initRequest3(System.Web.HttpRequest req);

void initBean(System.Web.SessionState.HttpSessionState ses);

}



[ProgId("test.Serviceproxy")]

public class Serviceproxy : _Serviceproxy

{

private string command;

private System.Web.HttpRequest request;

private System.Web.SessionState.HttpSessionState session;

public void initRequest2(string cmd)

{

this.command = cmd;

}

public void initRequest3(System.Web.HttpRequest req)

{

this.request = req;

}

public void initBean(System.Web.SessionState.HttpSessionState ses)

{

this.session = ses;

}

}



------------- in ASP ---------------------

<%

Set i = CreateObject("test.serviceproxy")

i.initRequest2 "just a test to pass some text!" //working

i.initRequest3 request //not working

i.initBean session //not working

set i = nothing

%>

------------------



bye

daniel
 
N

Nick

Daniel,

If you are using COM Interop, and are consuming the .NET component in an
unmanaged manner, then it will work much like vanilla COM wont it? Can you
wrapper the ASP session in a COM object, and then pass that COM wrapper to
your .NET component?

N.
Daniel Schwab said:
Hi Nick
How are you passing in the ASP session?

As far as i am i cannot pass the ASP session, i can only pass

ints or strings.

here's my code (only snipplets):

----------------------

------------in c# -----------------------

[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]

public interface _Serviceproxy

{

void initRequest2(string cmd);

void initRequest3(System.Web.HttpRequest req);

void initBean(System.Web.SessionState.HttpSessionState ses);

}



[ProgId("test.Serviceproxy")]

public class Serviceproxy : _Serviceproxy

{

private string command;

private System.Web.HttpRequest request;

private System.Web.SessionState.HttpSessionState session;

public void initRequest2(string cmd)

{

this.command = cmd;

}

public void initRequest3(System.Web.HttpRequest req)

{

this.request = req;

}

public void initBean(System.Web.SessionState.HttpSessionState ses)

{

this.session = ses;

}

}



------------- in ASP ---------------------

<%

Set i = CreateObject("test.serviceproxy")

i.initRequest2 "just a test to pass some text!" //working

i.initRequest3 request //not working

i.initBean session //not working

set i = nothing

%>

------------------



bye

daniel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top