Accessing ASP(not ASP.Net) built-in objects with C# 
Author Message
 Accessing ASP(not ASP.Net) built-in objects with C#

Is there a way to have a C# object that is instantiated
through ASP get the context of the ASP objects?  I've
tried numerous ways to get this to work, but with no
success.

Background:
I just migrated an ASP/J++ project to C#.  The migration
was going fairly smoothly until I tried to access the
built in ASP objects through my new C# back-end.  The C#
migration is painful enough right now and I don't have
time to migrate the ASP to ASP.Net also.



Sat, 14 Aug 2004 06:12:47 GMT  
 Accessing ASP(not ASP.Net) built-in objects with C#

You could try using the HttpContext object. This would return the current
context:

So in your C# components method, you could write something like the
following to use the response object:

       public  void Test()
       {
            HttpContext MyContext = HttpContext.Current;
            HttpResponse MyResponse = Context.Response;
            Response.Write ("Hello World");
      }

Hope this helps...

Ammar Abuthuraya
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.

Are you secure?  
For information about the Strategic Technology Protection Program and to
order your FREE Security Tool Kit, please visit
http://www.microsoft.com/security



Sat, 14 Aug 2004 09:46:35 GMT  
 Accessing ASP(not ASP.Net) built-in objects with C#
Wouldn't this give me the context of the ASP.Net objects,
which I am not running under?  ASP.Net runs under
aspnet_isapi.dll but ASP runs under asp.dll.  Two
completely separate sets of request/response objects.  If
I use the HttpContext, I would assume that I would get the
objects running under the aspnet_isapi.dll.

Also, for some mysterious reason, I have no classes under
my System.Web namespace(HttpContext, etc) or the
System.Web.UI namespace.  I do however have the class
libraries under System.Web.UI.Design  Would you have any
idea why they are not there?  I chose to install
everything during setup and it did install ASP.Net
capabilities, just not some of the required classes.

Quote:
>-----Original Message-----

>You could try using the HttpContext object. This would
return the current
>context:

>So in your C# component's method, you could write
something like the
>following to use the response object:

>       public  void Test()
>       {
>            HttpContext MyContext = HttpContext.Current;
>            HttpResponse MyResponse = Context.Response;
>            Response.Write ("Hello World");
>      }

>Hope this helps...

>Ammar Abuthuraya
>Microsoft Developer Support

>This posting is provided "AS IS" with no warranties, and
confers no rights.

>Are you secure?  
>For information about the Strategic Technology Protection
Program and to
>order your FREE Security Tool Kit, please visit
>http://www.microsoft.com/security

>.



Sun, 15 Aug 2004 01:03:57 GMT  
 Accessing ASP(not ASP.Net) built-in objects with C#

Actually, you should be able to use the HttpContext object the way
described below only if your C# object was developed as an ASP.NET
application. Now, if you are not using ASP.NET at all, there doesn't seem
to be a way to get the context of asp objects. I would guess that you could
probably use your C# component in a way similar to the way we used to use
web classes with asp (e.g. spitting html strings, etc. to be used within
your asp pages.)

Ammar Abuthuraya
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.



Mon, 16 Aug 2004 07:32:25 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. writing C# assambly for COM+ and use it by asp/vb/asp.net

2. Asp vs Asp.Net (Field access)

3. Professional ASP.NET Server Controls - Building Custom Controls with C#

4. How to call VB.net and ASP.net programs in MFC?(or,asp call vc)

5. Can ASP access .NET C# components?

6. Can not create web application (ASP.NET using C#)

7. How to access ASP document object in C# ?

8. Integrated Session Management for ASP.NET and ASP 3.0

9. need input ASP versus ASP.NET

10. ASP.NET (ADO.NET) connect to remote MS Access Database

11. .net server controls for access from asp.net

12. Emergency question on c# access remote Access Database from ASP.net

 

 
Powered by phpBB® Forum Software