473,379 Members | 1,255 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

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

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
3 4752
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Gerhard Pretorius | last post by:
ON Win 2003 IIS6, Since yesterday, (12 Aug 2003) for some strange reason, (after installing WindowsServer2003-KB823980-x86-ENU.exe) I cannot pass the Request object to to VB COM DLL. I have...
2
by: Matt | last post by:
How to pass data back and forth between ASP and JSP page? Let's say I have Java objects, how to pass the data back to ASP page?? Or ASP has data, how to pass the data to JSP page?? Please...
1
by: quest | last post by:
My webserver application (a http handler) accepts a sequence of requests from client. Each request requires an access to database (password/username supplied in the request). I am looking at...
1
by: Alex Brown | last post by:
We are switching from InProc mode to StateServer mode and have a somewhat unusual problem that I have not seen discussed. Sometime we pass the session object to a thread by reference and the...
2
by: macyp | last post by:
I have to pass values from one aspx page to another. The controls I have in the first page are: a textbox, 3 drop down lists, and 2 check boxes, and a submit button. It is a search page, and the...
3
by: Daniel Schwab | last post by:
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....
17
by: Rabbit | last post by:
Hi, On my 1st page, i have a function which gets a new ID value and need to transfer to another immediately. which I want to get in 2nd page using Request.form("txtID"), but doesn't work, the...
5
by: chromis | last post by:
Hi there, I've recently been updating a site to use locking on application level variables, and I am trying to use a commonly used method which copies the application struct into the request...
3
by: ThatsIT.net.au | last post by:
I am making a console app that requests pages from our site one after another. Each request starts a new session, What I want to do is make all requests in the same session. How can I do this. ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.