Last post Jun 10, 2007 10:29 AM by DarthMacgyver
Jun 08, 2007 04:25 PM|DarthMacgyver|LINK
I was just wondering of this was possible with an HTTP Handler.
I want to create a custom Server Variable at run time. I wanted to share this Server Variable as a Single Sign-On to another application.
For example, I need to send HTTP_FIRSTNAME to this other application on the same server. Where the application will see Request.ServerVariables("HTTP_FIRSTNAME")
as a test I have tried the following (does not work)
Public Class HeaderHandler
Public ReadOnly Property IsReusable() As Boolean Implements System.Web.IHttpHandler.IsReusable
Public Sub ProcessRequest(ByVal context As System.Web.HttpContext) Implements System.Web.IHttpHandler.ProcessRequest
context.Request.Headers.Add("HTTP_FIRSTNAME", "THE FIRST NAME")
context.Request.ServerVariables.Add("HTTP_LASTNAME", "THE LAST NAME")
Is this only possible with an ISAPI filter?
I cannot send this data in session or querystring, it must be send like this (requirement of the target application)
I will be using the ASP.net Membership with Active Directory for my single sign-on application.
Any help would greatly be appreciated, even if the answer is to use an ISAPI filter to do this, at least I will know that.
Jun 09, 2007 01:33 PM|Svante|LINK
It's rather unclear what you mean with "send HTTP_FIRSTNAME to this other application on the same server". You do mention single sign-on, so I'm guessing that you want your app to act as a front-end to this application in question - and to others.
There's probably no really simple solution if the target application *really* requires the credentials to be sent as HTTP headers. The most obvious way is to implement it as a proxy, i.e. your single sign-on app will forward requests to the target application,
with the HTTP headers in question added, and then get the responses and forward them to the requesting client. This does raise some other issues, so it's usually not trivial to implement.
Perhaps there are mitigating circumstances, can you please explain the requirements further?
Jun 09, 2007 07:55 PM|DarthMacgyver|LINK
The target application in place was written by a vendor. Their requirements to send client data to thier application is via HTTP headers. So for example, if a user registers via my application (I collect First Name, LastName, Email, etc...), I need to
set custom HTTP headers that conatins this data so the target application can read these.
It is not the preferred way I wanted to do this, but I am stuck with what is in place already.
The tagret application is a J2EE application while the registration application is going to be ASP.NET 2.0
Both applications would be in the same domain, so the URLS would be for the Registration and Target Application would look like...
Thanks for your quick response.
Jun 10, 2007 04:09 AM|Svante|LINK
I think you should try the reverse proxy option. There's a really simple skeleton available here:
http://www.codeproject.com/aspnet/HTTPReverseProxy.asp . You should be able to use that for a proof of concept. If the target application renders HTML with absolute URLs you may need to do
some rewriting of the outgoing HTML, otherwise you won't get subsequent requests to your proxy.
Jun 10, 2007 10:29 AM|DarthMacgyver|LINK
Thanks again for the reply, I will try this out and post back here with my results.