473,789 Members | 2,408 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem using Response.Redire ct from a User Control

I am using the Response.Redire ct method in a User Control to allow visitors
to click an ImageButton to take them to another page. However, when I click
the ImageButton I recieve the following error:
Response is not available in this context.
I am assuming this is due to the fact that I am calling the method from the
User Control rather than the Page. If I use context.Respons e.Redirect I am
given the following error:
Cannot redirect after HTTP headers have been sent.
However, I do not know of any other way to programmaticall y send the user to
another URL. What can I do to either make the Response.Redire ct method work
from a User Control, or what is another simple way to programmaticall y send
the user to another page? Thanks.
--
Nathan Sokalski
nj********@hotm ail.com
http://www.nathansokalski.com/
Nov 19 '05 #1
2 2550
try

server.transfer ("fishpage.aspx ");
Nov 19 '05 #2
That takes me to the desired page, however, I did not want to use it because
it does not change the displayed URL in the browser's Address Bar. This is a
problem in my application because the buttons that will be calling the
method are the primary navigation buttons. If I used Server.Transfer every
page on my entire site would have exactly the same URL. This would prevent
users from bookmarking and/or adding pages to their favorites.

--
Nathan Sokalski
nj********@hotm ail.com
http://www.nathansokalski.com/
"Josh" <s@a.com> wrote in message
news:%2******** ********@TK2MSF TNGP15.phx.gbl. ..
try

server.transfer ("fishpage.aspx ");

Nov 19 '05 #3

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

Similar topics

3
2252
by: VIJAY KUMAR | last post by:
Hi pals, I am using 2 web forms (pages). In first page, i have Datagrid control and on second page i have a hyper link control to the first page and Add value to the data grid/Database. Problem: when I click on the hyperlink on the second page, i am getting the first page with cahed data. But i didn't declare/Use code for cache data. when i
0
1707
by: WebHouse.Co | last post by:
Hi Sir I'm in my 2nd year in M.Sc. degree & I made a project about the powerful tools SQLXML 3.0 & updategram, so I made a list of programs which r they so similar to the example that using updategram with ASP That exist in the documentation of the Microsoft SQL Server XML Tools as the following page: Sample ASP Application
2
7338
by: patrick_a | last post by:
Hi, I'm having trouble with using !IsPostBack. I want to create a linkbutton within a table when the page loads the first time and then have the page redirect based on the LinkButton.CommandArgument string when the LinkButton is clicked. If I use if(!IsPostBack) as in the following code, the MyLinkButton_Click is never fired. If I remove the if(!IsPostBack) then when the LinkButton is clicked the Page_Load is executed (as you would...
3
1693
by: Ohad Young | last post by:
Hi, I have a frameset page that contains two frames: 1. the first frame, an aspx page, contains a menu for navigating in the website. 2. the second frame contains content, pdf, html or other aspx files The problem is that the menu activates a server-side methods when the user clicks on one of the menu items. However, from the server side I cannot control in which frame the content will appears, it will always be in the menu frame...
11
26886
by: Russ | last post by:
My web app writes some binary data to a file at the client site via Response.Write and Response.BinaryWrite. This action is accomplished in response to a button click, with C# code behind as follows: private void SubmitButton_Click (object sender, System.EventArgs e) { // Set up the response to write the print file to the client Response.Clear (); Response.AppendHeader ("Content-Disposition", "filename=WebPrint.prn");
2
1576
by: Nathan Sokalski | last post by:
I am using the Response.Redirect method in a User Control to allow visitors to click an ImageButton to take them to another page. However, when I click the ImageButton I recieve the following error: Response is not available in this context. I am assuming this is due to the fact that I am calling the method from the User Control rather than the Page. If I use context.Response.Redirect I am
1
1613
by: .NET Developer | last post by:
I'm having an issue that hopefully someone here can help me out with. First a quick explanation: I'm managing users of my site in a fairly custom way. (in other words I'm not using asp.net's built-in methods). I have my own database table for user info, and people can register on the site, and then log in. If they haven't logged in, they are considered a guest and I store their name as "guest" in a sessions table along with some other info...
12
2672
by: Patxi | last post by:
This is the first time I try to use cookies, and despite of reading some tutotials, I'm have real trouble to make it work correctly. My cookie reading code is in Master Page. When I click on a test button (in a WEb User Control inside the aspx page), cookie value is displayed in Master Page but if I go to another page, no value is displayed... I need to be able tu use cookie's value across all the site... What am I doing wrong ? Code...
1
7090
by: =?Utf-8?B?SGFyZHkgV2FuZw==?= | last post by:
Hi all, I am running ASP.NET 2.0, after login I need to pass CustomerID in my database instead of username to other pages. I added following code to my login.aspx protected void Login_Authenticate(object sender, AuthenticateEventArgs e) { //FormsAuthentication.SignOut(); if (Membership.ValidateUser(Login.UserName, Login.Password)) { int customerID = GetCustomerIDByUsername(Login.UserName); if (customerID 0) {
0
9663
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10404
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10193
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10136
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9016
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7525
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5548
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4089
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2906
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.