simple question

T

Tina

I have page1.aspx and page2.aspx.

Lets say page1 has a hyperlink to page2. If the user clicks on that
hyperlink Page two will be displayed either in a new window or the same
window(depending on which way I want it).

Now, I want exactly the same behavior to occur except that I don't want to
use a hyperlink. I want to put a button on page1 and when the user pushes
the button my code behind that button will decide if page2 should display or
not. But if it does decide that page2 should display, the behavior should
be exactly as if a hyperlink were used.

I can't seem to figure out how to do this. I read, here on this forum, that
server.transfer would do it but that does not work - the page1 url is still
displayed.

How can I do this?
Thanks,
T
 
S

S. Justin Gengo

Tina,

Here's how Response.Redirect and Server.Transfer work:

Response.Redirect - A user requests a web page. They click a button on the
page and a request is sent back to the server. The server sees code that
says, "Perform a response.redirect to page 2." The server sends the user's
computer the instruction to go to page 2, the users computer requests page 2
(they see page 2 in their address bar).

Server.Transfer - A user requests a web page. They click a button on the
page and a request is sent back to the server. The server sees code that
says, "Perform a server.transfer to page 2." The server gets page 2 and
sends it to the user's computer instead of page 1. The user's address bar
never changes because their computer doesn't know that it's page two that
was sent instead of page 1.

The code you are using is sending the user to page 2, it's just that it cuts
out the middleman so to speak and doesn't bother with making the user's
computer request page 2.

I hope this helps.

--
S. Justin Gengo, MCP
Web Developer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
 
T

Tina

S.,
Thanks for that clear and concise answser, I changed my Server.Transfer to a
Response.Redirect and the page now has the url of the correct asp page.
What I am actually doing in that page is the following:

Response.ContentType = "image/jpeg"
myBigImage.Save(Response.OutputStream, ImageFormat.Jpeg)

The Image its writing out to the page just fine but the user can't save it
as a jpg. I'm trying to duplicate the functionality that we used to do when
we had an href=myfile.jpg; target="_blank". the user got a brand new window
with a .jpg file that could be easily be saved.

Do you have any idea how I can duplicate this functionality from vb.net
code?

Thanks,

T
 
S

S. Justin Gengo

Tina,

Sorry, but I haven't worked at saving images dynamically as of yet. I really
have no idea where to start with that.

:(

Sincerely,

--
S. Justin Gengo, MCP
Web Developer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
 

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

Top