Server variables and redirect

Hello,
I know nothing about asp.net but i have problem which i think i can solve using it.

I have an ISAPI dll written using Intraweb (if you have not heard of it – don’t worry).

On my web site I have an isapi filter that prompts the user to login (via gmail or facebook), and then the users details are passed on to the web application as a number of server variables.
The web application, in my case an Intraweb isapi dll, does not seem to be able to read these variables… however I have some asp.net code that does.  So I know I can be done.

So I would like to write some asp.net code that looks for the variables, adds them to the request, and then does a redirect (or transfer) to my isapi.dll

This must be possible?

Sort of:

Get the server variable “USER_ID”

Add it to the current request as a query field, or content field

Redirect to my isapi dll


Can this be done? And how?

/richard
soozhCEOAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Miguel OzSoftware EngineerCommented:
It is possible, but why are you using the same request url? I think you should use a asp.net page as your point of entry and then redirect  to your Intraweb app. (If so just replace
Request.RawUrl  with  the new url)
You need to use the servervariables collection  in the Page_load event of your asp.net as follows:
protected void Page_Load(object sender, EventArgs e)
    {
   if (!Request.RawUrl.Contains("userId=")) //avoids adding the same var when page is called the second time
        {
            string userId = Request.ServerVariables["USER_ID"] + "3";
            string newUrl = Request.RawUrl + "?userId=" + userId; // if url has query parameters already use "&userId=" + userId
            Response.Redirect(newUrl);
        }
    }

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
soozhCEOAuthor Commented:
Thanks for the response.  

The example of code i have has "runat server" and some code that extracts the USER_ID.  

As the new page is on the same server perhaps i should use Transfer?
0
soozhCEOAuthor Commented:
I have tested your solution and passed the data as a Query fields.  This worked and i could read the fields in my Intraweb app.

However i would rather pass the data as content fields.

Any ideas how i would do that?
0
Exploring SQL Server 2016: Fundamentals

Learn the fundamentals of Microsoft SQL Server, a relational database management system that stores and retrieves data when requested by other software applications.

Miguel OzSoftware EngineerCommented:
Glad I solved your original question.
Regarding post-question I am not sure what you meant by content fields. Please provide example.
0
soozhCEOAuthor Commented:
hmm... now you want me to be an expert!

In intraweb there are Query Fields (which are part of the url) and Content Fields (which are not!).

I started to play around with the following code:

  // Get the login variables
  string username = Request.ServerVariables["IDP_USERNAME"] ;
  string email = Request.ServerVariables["IDP_EMAIL"] ;
  string uid = Request.ServerVariables["IDP_UID"] ;

  // Create the new request
  var request = WebRequest.Create("http://79.XXX.XXX.XX/PharosPortal/PharosPortal.dll/$/Start/");
  request.Method = "POST";
  request.ContentType = "application/x-www-form-urlencoded";
  using (var writer = new StreamWriter(request.GetRequestStream()))
  {
    writer.Write(username);
    writer.Write(email);
    writer.Write(uid);

  };

Open in new window


I think this creates what i call content fields.  But when i run it i get an error complaining about WebRequest.

Compiler Error Message: CS0103: The name 'WebRequest' does not exist in the current context

Open in new window


from which i can tell that i need to include something - but what?
0
Miguel OzSoftware EngineerCommented:
Your post question requires knowledge of Intraweb based on your explanation and the Delphi compiler error message shown above, You should ask your post question in the Delphi area. I do not have experience with Delphi Intraweb so I can not comment whether your last comment's  code works or not.

Note: The only reason I answer your original question: " I have an ISAPI dll written using Intraweb (if you have not heard of it – don’t worry)."
0
soozhCEOAuthor Commented:
This is did not 100% solve my problem but gave me some help in finding a solution.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.