Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > how to redirect to same page

Reply
Thread Tools

how to redirect to same page

 
 
Carlos
Guest
Posts: n/a
 
      09-24-2009
Hi all,

I have a page that when loads queries a parameter
that contains the URL where it came from. It also has
a button that when clicked, performs a DB operation and
redirects to the same page to check if there are more records
pending.

The problem is that when there are no more records pending,
I want to go back to the original URL. But when the postback occurs
in the button the page name gets appended to the URL forming an invalid
address.

If for example, it starts browsing at
http://www.mysite.com/mypage.aspx?ou...yothersite.com


appends
http://www.mysite.com/mypage.aspx/my...myothesite.com
which is invalid. hat would be the best way to do this?

I am currently using server.transfer("#")

Thanks,

Carlos.


 
Reply With Quote
 
 
 
 
Alexey Smirnov
Guest
Posts: n/a
 
      09-25-2009
On Sep 24, 6:30*pm, "Carlos" <(E-Mail Removed)> wrote:
> Hi all,
>
> *I have a page that when loads queries a parameter
> that contains the URL where it came from. It also has
> a button that when clicked, performs a DB operation and
> redirects to the same page to check if there are more records
> pending.
>
> The problem is that when there are no more records pending,
> I want to go back to the original URL. But when the postback occurs
> in the button the page name gets appended to the URL forming an invalid
> address.
>
> If for example, it starts browsing athttp://www.mysite.com/mypage.aspx?ourl=http://www.myothersite.com
>
> appendshttp://www.mysite.com/mypage.aspx/mypage.aspx?orurl=http://www.myothe...
> which is invalid. hat would be the best way to do this?
>
> I am currently using server.transfer("#")
>
> Thanks,
>
> * *Carlos.


Hi Carlos,

I think if you skip server.transfer("#") it will load you the same
page.

In case you need to redirect, you could use something like...

string qs = "";

foreach (string key in Request.QueryString.Keys)
{
qs += key + "=" + Request.QueryString[key] + "&";
}

server.transfer("mypage.aspx?"+qs)
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Response.redirect does not redirect from .aspx page =?Utf-8?B?VHJveQ==?= ASP .Net 3 10-15-2008 09:07 PM
Basic Q - Response.Redirect, all redirect to first Response.Redirect statement Sal ASP .Net Web Controls 1 05-15-2004 03:46 PM
Is a Response.Redirect to the same page a Postback? Bruce W..1 ASP .Net 3 12-10-2003 11:05 PM
Re: Does redirect to self URL same as refresh page ? Frank Drebin ASP .Net 0 08-25-2003 09:54 PM



Advertisments