Response.redirect

P

Paul

I'm not getting the results I want when I use
Response.Redirct in a ASP page.

I enter this line of code in a asp page from domain1.com.


Response.Redirect "http://www.domain2.com/VDIR2/table.asp"
& "?PubID=" & PubID & "&PubName=" & PubName

The query string is data to open a DB. the page displays
but the DB does not open.

That's because when it redirects I notice in the address
bar of IE that it looks like this

http://www.domain1.com/VDIR1/table.asp?
PubID=100&PubName=thename

I told it to redirect to domain2 but I see domain1 in the
address bar.

If I type out the URL to domain2 with all the params
everything works fine, so the problem is with how I am
redirecting there.

The redirect above is inside an IF statement which says if
the PubID is less then 100 I go to the table.asp page on
domain2.com else I stay with table.asp on domain1.com

Any ideas

PAul
 
A

Adrienne

I'm not getting the results I want when I use
Response.Redirct in a ASP page.

I enter this line of code in a asp page from domain1.com.


Response.Redirect "http://www.domain2.com/VDIR2/table.asp"
& "?PubID=" & PubID & "&PubName=" & PubName

The query string is data to open a DB. the page displays
but the DB does not open.

That's because when it redirects I notice in the address
bar of IE that it looks like this

http://www.domain1.com/VDIR1/table.asp?
PubID=100&PubName=thename

I told it to redirect to domain2 but I see domain1 in the
address bar.

If I type out the URL to domain2 with all the params
everything works fine, so the problem is with how I am
redirecting there.

The redirect above is inside an IF statement which says if
the PubID is less then 100 I go to the table.asp page on
domain2.com else I stay with table.asp on domain1.com

Any ideas

PAul

What happens if you response.write in the IF statement?

if pubid < 100 then
response.write "I am going to domain2"
else
response.write "I staying right here"
end if

Is Pubid really a number, or is it a string? If it's a string, convert it
to a number, and then test it.
 
P

Paul

If I do the test you suggested it works as expected. and
yes PubId is a number.

The If statement works correctly, if pubID > 100 I stay on
my IIS server, if PubID < 100 I redirect to another IIS
server someplace else. the problem occurs when PubId < 100
and I redirect using this line of code:

Response.Redirect "http://www.domain2.com/VDIR2/table.asp"
& "?PubID=" & PubID & "&PubName=" & PubName

When PubId < 100 I see In the IE address bar the redirect
above with the acception that www.domain2.com is replaced
with www.domain1.com.

domain1 is my domain, It points to my IIS server, domain2
is somebody elses IIS server that I need to redirect to.

When PubID < 100 and things fail, I merely need to edit
the address bar URL by changing domain1.com to domain2.com
and hit return. Then I get what I want.

So some how even though I redirect to domain2 something is
replacing it with domain1.
 
P

Paul

I just figured it out.

You need to do a Response.Clear before you redirect to
another server.

Thanks anyway
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,175
Latest member
Vinay Kumar_ Nevatia
Top