473,503 Members | 1,670 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using Session cookie to access ASP from within ASP.NET

I have a site that I'm trying to migrate to ASP.NET from ASP, and the
foremost stumbling block I'm hitting is session state between the ASP
and ASP.NET applications. In order to access this information, I'm
doing a HttpWebRequest from the ASP.NET side into an .asp page,
passing the session name on the get in order to request it from the
ASP side and write it back to the response stream, giving ASP.NET
access to it. Of course I change sessions each time I make the call
from the ASP.NET side.

Soooooo, I'm thinking to myself, "Self, shouldn't you be able to fake
out the server by getting the session cookie from the initial usage of
the asp, pass that data to the ASP.NET, and use that to send a request
back the ASP side under the appropriate session?"

From a real high level, I enter the site via a .asp page. This page
in turn calls .aspx page from within a frame

<frame src="init.aspx?SessionCookie=<%=request.servervari ables("HTTP_COOKIE")%>">

init.aspx calls a class that makes the call to the session lookup page
(called lookup.asp). The gist is as follows (rough draft):

string sReqURI = . . . defined to pass along the request on the get

HttpWebRequest oRequest = (HttpWebRequest)WebRequest.Create(sReqURI);
oRequest.CookieContainer = new CookieContainer();
System.Net.Cookie oCookie = new System.Net.Cookie(m_sSessionKey,
m_sSessionValue);
oCookie.Domain = m_sDomain;
oRequest.CookieContainer.Add(oCookie);

HttpWebResponse oResponse = (HttpWebResponse) oRequest.GetResponse();

Stream receiveStream = oResponse.GetResponseStream();

System.Text.Encoding encode =
System.Text.Encoding.GetEncoding("utf-8");

StreamReader readStream = new StreamReader( receiveStream, encode );

char[] read = new char[256];
// Reads 256 characters at a time.
int count = readStream.Read( read, 0, 256 );

while (count > 0)
{
// Dumps the 256 characters on a string and displays the string to the
console.
sValue = new String(read, 0, count);
count = readStream.Read(read, 0, 256);
}
// Releases the resources of the response.
oResponse.Close();
// Releases the resources of the Stream.
readStream.Close();

I can get a response, and if I set actual text in the asp page, I can
retrieve it, so I know that's fine. Can't access the previous
session, though. Anybody have any experience along these lines?

Thanks,
Dax
Nov 17 '05 #1
0 898

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
5757
by: Dax Westerman | last post by:
I have a site that I'm trying to migrate to ASP.NET from ASP, and the foremost stumbling block I'm hitting is session state between the ASP and ASP.NET applications. In order to access this...
2
1312
by: wozza | last post by:
Hi I'm involved in quite a large project which has a slightly unusual form of login (at least I think it's unusual!). I'm creating a site in ASP (actually Chilisoft ASP) where access to all...
0
1159
by: Dax Westerman | last post by:
I have a site that I'm trying to migrate to ASP.NET from ASP, and the foremost stumbling block I'm hitting is session state between the ASP and ASP.NET applications. In order to access this...
2
1495
by: WJ | last post by:
I am setting the Session State TimeOut to 54 minutes (20 is default) in the Web.Config. I use SQL Server to persist the session states & ID. As long as I am remaining in the web sites, I see all...
7
7757
by: Doug | last post by:
An ASP.NET session cookie set on "www.mydomain.com" can not be accessed on "search.mydomain.com"; hence, a new session and cookie are being created on every sub-domain. This is occuring because...
5
4824
by: Åženol Akbulak | last post by:
Hello; I use in my web application FormsAuthentication. Also I use Session state (InProc). When a user logged in, I can read Session parameters. (For example Session). Problem is that, when...
5
8223
by: jb | last post by:
*Please* help --- I'm tearing my hair out. I want to use sessionstate in a webservice, accessed from a client, written in script (JScript, InfoPath). I have written my webservice (C# .NET). I...
10
2164
by: Li Pang | last post by:
Hi, I created a html page from which I give a link to another web site. The new site is opened in a new window. When I opened multiple windows, they all have the same SessionID. I want ot know...
3
12685
by: mosesdinakaran | last post by:
Hi Where does the cookies stored in the client machine that php creates after calling session_start() function. I am using IE... I checked in the following folders but no cookies are stored....
3
10347
by: JDS | last post by:
So, I'd like to create the following scenario: 1) Use cURL library within PHP (cURL + "Cookie Jar", et.al) to create a virtual browser session that "logs in" to a remote site. (For example: ...
0
7083
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...
0
7278
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,...
0
7328
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...
1
6988
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...
0
5578
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,...
1
5011
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...
0
4672
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...
0
3166
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...
0
379
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...

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.