By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,022 Members | 856 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,022 IT Pros & Developers. It's quick & easy.

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

P: n/a
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/de...-us/Dnaspp/htm
l/aspnetmigrissues.asp?frame=true#aspnetmigrissues_s tate)

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

Jul 21 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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/de...-us/Dnaspp/htm
l/aspnetmigrissues.asp?frame=true#aspnetmigrissues_s tate)

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


Jul 21 '05 #2

P: n/a
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.InterfaceIsIDispatc h)]

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




Jul 21 '05 #3

P: n/a
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" <da************@swisscom.com> wrote in message
news:1074701752.101149@ftpgate...
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.InterfaceIsIDispatc h)]

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



Jul 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.