473,805 Members | 2,055 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 4775
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
11591
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
4607
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
12371
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
7081
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
6138
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
9716
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10609
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10360
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...
1
10366
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9185
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
7646
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
6876
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();...
1
4323
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3007
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.