473,796 Members | 2,632 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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
NameValueCollec tion
(http://msdn.microsoft.com/library/de...-us/Dnaspp/htm
l/aspnetmigrissue s.asp?frame=tru e#aspnetmigriss ues_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

Jul 21 '05 #1
3 4774
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
NameValueCollec tion
(http://msdn.microsoft.com/library/de...-us/Dnaspp/htm
l/aspnetmigrissue s.asp?frame=tru e#aspnetmigriss ues_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


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(C omInterfaceType .InterfaceIsIDi spatch)]

public interface _Serviceproxy

{

void initRequest2(st ring cmd);

void initRequest3(Sy stem.Web.HttpRe quest req);

void initBean(System .Web.SessionSta te.HttpSessionS tate ses);

}

[ProgId("test.Se rviceproxy")]

public class Serviceproxy : _Serviceproxy

{

private string command;

private System.Web.Http Request request;

private System.Web.Sess ionState.HttpSe ssionState session;

public void initRequest2(st ring cmd)

{

this.command = cmd;

}

public void initRequest3(Sy stem.Web.HttpRe quest req)

{

this.request = req;

}

public void initBean(System .Web.SessionSta te.HttpSessionS tate ses)

{

this.session = ses;

}

}

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

<%

Set i = CreateObject("t est.serviceprox y")

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(C omInterfaceType .InterfaceIsIDi spatch)]

public interface _Serviceproxy

{

void initRequest2(st ring cmd);

void initRequest3(Sy stem.Web.HttpRe quest req);

void initBean(System .Web.SessionSta te.HttpSessionS tate ses);

}

[ProgId("test.Se rviceproxy")]

public class Serviceproxy : _Serviceproxy

{

private string command;

private System.Web.Http Request request;

private System.Web.Sess ionState.HttpSe ssionState session;

public void initRequest2(st ring cmd)

{

this.command = cmd;

}

public void initRequest3(Sy stem.Web.HttpRe quest req)

{

this.request = req;

}

public void initBean(System .Web.SessionSta te.HttpSessionS tate ses)

{

this.session = ses;

}

}

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

<%

Set i = CreateObject("t est.serviceprox y")

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
11589
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 a funciton inVB DLL Function BuildSqlWhereFromHTML(ByRef AspReq As ASPTypeLibrary.Request, _ ByRef AspSes As ASPTypeLibrary.Session) As String
2
4606
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 advise. Thanks!
1
3340
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 improving the performance of the webserver. My questions: 1. How should I handle the session as the client will post one request after antoher (for may be consequtively 5 requests) ? 2. Is there any way to 'cache' the database connection and reuse...
1
1402
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 thread will modify objects in the session. The thread does some work and updates status in the session object. The client refreshes every few seconds and checks the status (it is a long running task). This works fine in InProc mode. However, this...
2
12364
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 users need not enter values in all the controls. they can leave the textbox blank, and select values from one drop down, or any other combinations. I am trying to pass values with the help of session variables. But I have multiple if else...
3
597
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. I wrote the component according to the guide from http://www.codeproject.com/dotnet/nettocom.asp
17
7080
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 returned value is "" Anybody know how to set this value on 1st page properly, in order to let 2nd page catch it? I don't want to use querystring to pass this value!
5
6135
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 scope. Application variables are then accessed in this manner Request.App.<Var>. To begin with I had a simple functioning login system inside a subdirectory named admin, this subdirectory had it's own application.cfm, I wasn't sure whether to duplicate...
3
8839
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. I was hoping to be able to get the session back from first request and then set them on each further request. Any ideas?
0
9533
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10239
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10019
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9057
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7555
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6796
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5447
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5579
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2928
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.