473,387 Members | 1,453 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Posting to another server and end up there?


Hello

I have a login form on a page that should post the data to a non Windows
server and upon successful authentication, the browser needs to show the
secodn url.

I did the form post, got the successful results back but the browser is
still showing at the same url. Which method needs to be used so that the
browser shows the target url. In this case it's sURL in my code. sHTML is
the result from the successful result from posting the form to the non
Windows server.

As an example, imagine you want to put a Hotmail login form in your own
site, post the form using your asp.net code and the browser ends up inside
Hotmail showing a hotmail.com url.

Code Snippet:

Response.ClearContent();
Response.ClearHeaders();
Response.ContentType = "text/html";
Response.Write(sHtml);
Response.RedirectLocation = sURL;
Response.Flush();
Response.Close();
John Dalberg

Jul 19 '05 #1
18 2311
Replace;

Response.RedirectLocation = sURL;

With

Response.Redirect sURL

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!
"John Dalberg" <jo*****@hotmail.com> wrote in message
news:1n*****************************@40tude.net...

Hello

I have a login form on a page that should post the data to a non Windows
server and upon successful authentication, the browser needs to show the
secodn url.

I did the form post, got the successful results back but the browser is
still showing at the same url. Which method needs to be used so that the
browser shows the target url. In this case it's sURL in my code. sHTML is
the result from the successful result from posting the form to the non
Windows server.

As an example, imagine you want to put a Hotmail login form in your own
site, post the form using your asp.net code and the browser ends up inside
Hotmail showing a hotmail.com url.

Code Snippet:

Response.ClearContent();
Response.ClearHeaders();
Response.ContentType = "text/html";
Response.Write(sHtml);
Response.RedirectLocation = sURL;
Response.Flush();
Response.Close();
John Dalberg

Jul 19 '05 #2
On Tue, 21 Sep 2004 18:59:11 +0100, Steven Burn wrote:
Replace;

Response.RedirectLocation = sURL;

With

Response.Redirect sURL


Response.Redirect is just telling the browser to go to that url and start
fresh. I will lose all my post results that I got earlier.

John
Jul 19 '05 #3
> Response.Redirect is just telling the browser to go to that url and start
fresh.

I know....
I will lose all my post results that I got earlier.
Not if you place the Response.Redirect after the code that grabs the posted
info.... (I screwed up in my first reply as I wasn't aware of the
Response.RedirectLocation method)

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!
"John Dalberg" <jo*****@hotmail.com> wrote in message
news:1p******************************@40tude.net.. . On Tue, 21 Sep 2004 18:59:11 +0100, Steven Burn wrote:
Replace;

Response.RedirectLocation = sURL;

With

Response.Redirect sURL


Response.Redirect is just telling the browser to go to that url and start
fresh. I will lose all my post results that I got earlier.

John

Jul 19 '05 #4
On Tue, 21 Sep 2004 20:07:00 +0100, Steven Burn wrote:
Response.Redirect is just telling the browser to go to that url and start

fresh.

I know....
I will lose all my post results that I got earlier.


Not if you place the Response.Redirect after the code that grabs the posted
info.... (I screwed up in my first reply as I wasn't aware of the
Response.RedirectLocation method)


I am not sure what you're tying to say. A redirect causes my code to go
back to the browser and any code after the redirect is not run.
A redirect is just a get method. The url I am using is for a post method
which expects post data and the post is what gets me logged in. If the url
doesn't get post data, the browser gets an error message. That's what I get
when I used response.redirect.
When I said losing my post results, I meant if I do redirect, the browser
is not going to get the post result and the browser loses it. However the
post result html is in my code in a string.

John
Jul 19 '05 #5
IIRC you are trying to jump directly from a form on your site to another
site. Why can't you just make the target sites user validation script the
action of your form?

--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com
"John Dalberg" <jo*****@hotmail.com> wrote in message
news:9e******************************@40tude.net.. .
On Tue, 21 Sep 2004 20:07:00 +0100, Steven Burn wrote:
Response.Redirect is just telling the browser to go to that url and
start fresh.

I know....
I will lose all my post results that I got earlier.
Not if you place the Response.Redirect after the code that grabs the posted info.... (I screwed up in my first reply as I wasn't aware of the
Response.RedirectLocation method)


I am not sure what you're tying to say. A redirect causes my code to go
back to the browser and any code after the redirect is not run.
A redirect is just a get method. The url I am using is for a post method
which expects post data and the post is what gets me logged in. If the url
doesn't get post data, the browser gets an error message. That's what I

get when I used response.redirect.
When I said losing my post results, I meant if I do redirect, the browser
is not going to get the post result and the browser loses it. However the
post result html is in my code in a string.

John

Jul 19 '05 #6
On Tue, 21 Sep 2004 13:42:11 -0700, Mark Schupp wrote:
IIRC you are trying to jump directly from a form on your site to another
site. Why can't you just make the target sites user validation script the
action of your form?


I don't understand what you mean. There's no validation script on the page.

John
Jul 19 '05 #7
Oks, put simply, you mentioned that you confirm that everything was oks at
the authorisation level yes? and if everything is oks, you want it to re-dir
to the second URL?

All I'm saying is, do whatever your doing now (that you've said is
working?), and just place the Redirect action, after your authorisation.

For example

'// Your authorisation code goes here

blnSuccess = "somewhere.com/?auth=AuthoriseMe"

'// Where blnSuccess returns 1 for success and 0 or whatever
'// for fail.

If blnSuccess = 1 Then
Response.Redirect strSecondURL
Else
Response.Write "Woops, something went wrong"
End If

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!
"John Dalberg" <jo*****@hotmail.com> wrote in message
news:9e******************************@40tude.net.. .
On Tue, 21 Sep 2004 20:07:00 +0100, Steven Burn wrote:
Response.Redirect is just telling the browser to go to that url and
start fresh.

I know....
I will lose all my post results that I got earlier.
Not if you place the Response.Redirect after the code that grabs the posted info.... (I screwed up in my first reply as I wasn't aware of the
Response.RedirectLocation method)


I am not sure what you're tying to say. A redirect causes my code to go
back to the browser and any code after the redirect is not run.
A redirect is just a get method. The url I am using is for a post method
which expects post data and the post is what gets me logged in. If the url
doesn't get post data, the browser gets an error message. That's what I

get when I used response.redirect.
When I said losing my post results, I meant if I do redirect, the browser
is not going to get the post result and the browser loses it. However the
post result html is in my code in a string.

John

Jul 19 '05 #8
> I don't understand what you mean. There's no validation script on the
page.

I thought you said;

<snip>
.........post the data to a non Windows
server and upon successful authentication, the browser needs to show the
secodn url. I did the form post, got the successful results back ....... </snip>

To get a successful authentication, you need to have validation, otherwise,
the authentication is invalid.

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!
"John Dalberg" <jo*****@hotmail.com> wrote in message
news:o8*****************************@40tude.net... On Tue, 21 Sep 2004 13:42:11 -0700, Mark Schupp wrote:
IIRC you are trying to jump directly from a form on your site to another
site. Why can't you just make the target sites user validation script the action of your form?
I don't understand what you mean. There's no validation script on the

page.
John

Jul 19 '05 #9
Ok, Lets back up a step. A lot of the background info go trimmed and needs
to be re-stated in your next response.

IIRC:

You have a form on your site that is a copy of the login form for another
site.

You want to have data from that form posted to another server for user
authentication.

Then you want to direct the user to another URL. I thought I understood this
URL to be where the user would be taken if they had used the login form on
the other site in the first place. If that is the case then just post your
form to the same place that the form on the other site is posted to. If that
is not the case, please clarify what you need.

--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com
"John Dalberg" <jo*****@hotmail.com> wrote in message
news:o8*****************************@40tude.net...
On Tue, 21 Sep 2004 13:42:11 -0700, Mark Schupp wrote:
IIRC you are trying to jump directly from a form on your site to another
site. Why can't you just make the target sites user validation script the action of your form?
I don't understand what you mean. There's no validation script on the

page.
John

Jul 19 '05 #10
On Tue, 21 Sep 2004 22:21:34 +0100, Steven Burn wrote:
I don't understand what you mean. There's no validation script on the

page.

I thought you said;

<snip>
.........post the data to a non Windows
server and upon successful authentication, the browser needs to show the
secodn url.

I did the form post, got the successful results back .......

</snip>

To get a successful authentication, you need to have validation, otherwise,
the authentication is invalid.


Thanks for the feedback. See my response to Mark.
Jul 19 '05 #11
On Tue, 21 Sep 2004 14:37:32 -0700, Mark Schupp wrote:
Ok, Lets back up a step. A lot of the background info go trimmed and needs
to be re-stated in your next response.

IIRC:

You have a form on your site that is a copy of the login form for another
site.

You want to have data from that form posted to another server for user
authentication.

Then you want to direct the user to another URL. I thought I understood this
URL to be where the user would be taken if they had used the login form on
the other site in the first place. If that is the case then just post your
form to the same place that the form on the other site is posted to. If that
is not the case, please clarify what you need.


Yes that's what I want to do.
I think I found the issue. I will try something.

John
Jul 19 '05 #12
On Tue, 21 Sep 2004 14:37:32 -0700, Mark Schupp wrote:
Ok, Lets back up a step. A lot of the background info go trimmed and needs
to be re-stated in your next response.

IIRC:

You have a form on your site that is a copy of the login form for another
site.

You want to have data from that form posted to another server for user
authentication.

Then you want to direct the user to another URL. I thought I understood this
URL to be where the user would be taken if they had used the login form on
the other site in the first place. If that is the case then just post your
form to the same place that the form on the other site is posted to. If that
is not the case, please clarify what you need.


Yes that's basically what I want to do but the browser still shows the
initial url.

I am doing the post to the second location using System.Net.HttpWebRequest
and I get the proper response and I then flush the current
System.Web.httpResponse and pump the response from HttpWebResponse into the
Current Response object. I am not sure if this is the proper way to do it..
It's like cheating because I changed the contents of the response object
but the client, the browser, is not aware now that the response is from the
other url. It thinks the response came from the initial form page.

AFAIK, response.redirect tells the browser to go to a certain url and get
it so basically I am starting at the remote login page, which I do not
want. What needs to happen is the browser needs to think it already logged
in on the other server.

I might just be missing an obvious fact but I am not seeing it.

John
Jul 19 '05 #13
> AFAIK, response.redirect tells the browser to go to a certain url and get
it so basically I am starting at the remote login page, which I do not
want. What needs to happen is the browser needs to think it already logged
in on the other server.
Am I right in thinking, a cookie is set upon successful authorisation?, if
so, this may be where the problem is as it could quite possibly be a case of
the cookie being tied to your first (login) domain, instead of the domain
you are querying/wanting to go to.

If not, what does the second URL usually use? (cookies, sessions etc?)

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!
"John Dalberg" <jo*****@hotmail.com> wrote in message
news:mt****************************@40tude.net... On Tue, 21 Sep 2004 14:37:32 -0700, Mark Schupp wrote:
Ok, Lets back up a step. A lot of the background info go trimmed and needs to be re-stated in your next response.

IIRC:

You have a form on your site that is a copy of the login form for another site.

You want to have data from that form posted to another server for user
authentication.

Then you want to direct the user to another URL. I thought I understood this URL to be where the user would be taken if they had used the login form on the other site in the first place. If that is the case then just post your form to the same place that the form on the other site is posted to. If that is not the case, please clarify what you need.
Yes that's basically what I want to do but the browser still shows the
initial url.

I am doing the post to the second location using System.Net.HttpWebRequest
and I get the proper response and I then flush the current
System.Web.httpResponse and pump the response from HttpWebResponse into

the Current Response object. I am not sure if this is the proper way to do it.. It's like cheating because I changed the contents of the response object
but the client, the browser, is not aware now that the response is from the other url. It thinks the response came from the initial form page.

AFAIK, response.redirect tells the browser to go to a certain url and get
it so basically I am starting at the remote login page, which I do not
want. What needs to happen is the browser needs to think it already logged
in on the other server.

I might just be missing an obvious fact but I am not seeing it.

John

Jul 19 '05 #14
On Wed, 22 Sep 2004 17:37:41 +0100, Steven Burn wrote:
AFAIK, response.redirect tells the browser to go to a certain url and get
it so basically I am starting at the remote login page, which I do not
want. What needs to happen is the browser needs to think it already logged
in on the other server.


Am I right in thinking, a cookie is set upon successful authorisation?, if
so, this may be where the problem is as it could quite possibly be a case of
the cookie being tied to your first (login) domain, instead of the domain
you are querying/wanting to go to.

If not, what does the second URL usually use? (cookies, sessions etc?)


There are no cookies set. I cleared the cookie file in Firefox, went to the
second url, logged in, closed Firefox, looked at the cookie file and it was
still empty.

The second url uses an interesting authentication scheme. Once you're
logged in using a form post, all the urls in the links in the next page
have what seems to be your own session id in them.
No cookies and no query strings are used. But I also have the a problem
because the urls are relative

So I guess because it's not using cookies or query string, a redirect won't
work because the browser doesn't know who I am.

Although there's another solution where I create a form dynamically and
sent it to the browser along with a form.submit() Javascript, this depends
on Javascipt enabled browser. That's why I wanted to do it in a pure
asp.net way.

John


Jul 19 '05 #15
> That's why I wanted to do it in a pure asp.net way.

Ah.... I've a feeling this has contributed to the confusion as this NG is
for classic ASP.

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!
"John Dalberg" <jo*****@hotmail.com> wrote in message
news:1o******************************@40tude.net.. .
On Wed, 22 Sep 2004 17:37:41 +0100, Steven Burn wrote:
AFAIK, response.redirect tells the browser to go to a certain url and get it so basically I am starting at the remote login page, which I do not
want. What needs to happen is the browser needs to think it already logged in on the other server.
Am I right in thinking, a cookie is set upon successful authorisation?, if so, this may be where the problem is as it could quite possibly be a case of the cookie being tied to your first (login) domain, instead of the domain you are querying/wanting to go to.

If not, what does the second URL usually use? (cookies, sessions etc?)


There are no cookies set. I cleared the cookie file in Firefox, went to

the second url, logged in, closed Firefox, looked at the cookie file and it was still empty.

The second url uses an interesting authentication scheme. Once you're
logged in using a form post, all the urls in the links in the next page
have what seems to be your own session id in them.
No cookies and no query strings are used. But I also have the a problem
because the urls are relative

So I guess because it's not using cookies or query string, a redirect won't work because the browser doesn't know who I am.

Although there's another solution where I create a form dynamically and
sent it to the browser along with a form.submit() Javascript, this depends
on Javascipt enabled browser. That's why I wanted to do it in a pure
asp.net way.

John

Jul 19 '05 #16
"John Dalberg" <jo*****@hotmail.com> wrote in message
news:1o******************************@40tude.net.. .
On Wed, 22 Sep 2004 17:37:41 +0100, Steven Burn wrote:
AFAIK, response.redirect tells the browser to go to a certain url and get it so basically I am starting at the remote login page, which I do not
want. What needs to happen is the browser needs to think it already logged in on the other server.
Am I right in thinking, a cookie is set upon successful authorisation?, if so, this may be where the problem is as it could quite possibly be a case of the cookie being tied to your first (login) domain, instead of the domain you are querying/wanting to go to.

If not, what does the second URL usually use? (cookies, sessions etc?)


There are no cookies set. I cleared the cookie file in Firefox, went to

the second url, logged in, closed Firefox, looked at the cookie file and it was still empty.

The second url uses an interesting authentication scheme. Once you're
logged in using a form post, all the urls in the links in the next page
have what seems to be your own session id in them.
No cookies and no query strings are used. But I also have the a problem
because the urls are relative

So I guess because it's not using cookies or query string, a redirect won't work because the browser doesn't know who I am.

Although there's another solution where I create a form dynamically and
sent it to the browser along with a form.submit() Javascript, this depends
on Javascipt enabled browser. That's why I wanted to do it in a pure
asp.net way.


Here's an article on reading the contents of a remote web page. Note the
section that talks about adding a <BASE> tag to the returned content.

http://aspfaq.com/show.asp?id=2173

So, you can do two things:
1. Use the above to return the content of the page returned after logging
in, adding the appropriate <BASE> tag

OR

2. Parse the returned content for the pseudo-cookie embedded in each anchor
href/ form action. Then response redirect to the url of the resulting page,
appending the pseudo-cookie to the querystring.
Jul 19 '05 #17
On Wed, 22 Sep 2004 20:15:30 +0100, Steven Burn wrote:
That's why I wanted to do it in a pure asp.net way.


Ah.... I've a feeling this has contributed to the confusion as this NG is
for classic ASP.


Sorry.. I can't believe I didn't notice this.

John
Jul 19 '05 #18
No apology necessary :o)

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!
"John Dalberg" <jo*****@hotmail.com> wrote in message
news:1m*******************************@40tude.net. ..
On Wed, 22 Sep 2004 20:15:30 +0100, Steven Burn wrote:
That's why I wanted to do it in a pure asp.net way.


Ah.... I've a feeling this has contributed to the confusion as this NG is for classic ASP.


Sorry.. I can't believe I didn't notice this.

John

Jul 19 '05 #19

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

Similar topics

2
by: Jonathan M. Rose | last post by:
I am looking for a script that I can sit on an HTML server (Linux, Apache, PHP/Perl/Python/Etc.) that will allow me to do the following things: 1) Post news articles that consists of (i) a title...
6
by: anon | last post by:
Post Forwarding question...... For this control below, <asp:Button runat="server" PostTargetUrl="page2.aspx" /> The Attribute: PostTargetUrl="page2.aspx" Is this PostTargetUrl Attribute...
10
by: DaveFash | last post by:
Posting variables from an HTML FORM, via the Request.Form function on the receiving ASP page is great. But how can you POST a Form variable to an ASP page -- without a human pushing a Submit...
6
by: Alan Silver | last post by:
Hello, I have a page where users can alter the contents of a shopping basket. Once they are happy with the contents, they click a "checkout" button and are taken to the checkout page. What...
3
by: Adam Knight | last post by:
Hi all, I have a form that i want to benefit from aspx functionality (ie: viewstate, validation). However for the posting of the form, i want to simply transfer execution to another script. ...
6
by: Andrew | last post by:
Hello, friends, I tried to do cross-page posting, i.e., in firstpage.aspx I used action="secondpage.aspx". Since I am using asp.net 1.1, so it always goes back to firstpage.aspx aftern...
29
by: Gernot Frisch | last post by:
Hi, I have no clue. - I want to align the red, green, blue boxes in one line - red,green,blue must be 45px high - red (center) must be as wide as possible - yellow must start exactly below...
5
by: vaj | last post by:
Hey, Im creating a system on a pocket pc based on win ce 4.2 and i need to tranfer three datasets to a remote server on the network.Could anyone tell me the easiest way to do this? cheers, -vaj
0
by: kwilliams1130 | last post by:
I am having a problem with data that is being posted to another server. The problem is I collect the data from our database through an .cfm file (and all data is correct), which then the data is...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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,...
0
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
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...

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.