Refresh Page. Shouldn't this be simple?!

S

Shapper

Hello,

I have the function changeCulture(culture As String) in all my .aspx web
pages. This functions changes Threat Culture among other actions.

So the new culture takes effect I need to refresh the current page
preserving the URL which can contain URL parameters (query).

I tried 2 solutions:

Dim refreshURL As String = this.GetType().Name
Response.Redirect(refreshURL.Replace("_", "."))

ERROR:
Name 'this' is not declared.

AND

Response.Redirect(Request.Url.AbsoluteUri)

ERROR:
Redirection limit for this URL exceeded.
Unable to load the requested page.
This may be caused by cookies that are blocked.


Anyway, I don't even know if these are the best ways to do it.
Can someone help me out?

Refreshing current page should be easy...or maybe not. :)

Thanks,
Miguel
 
C

Craig Deelsnyder

see inline

Hello,

I have the function changeCulture(culture As String) in all my .aspx web
pages. This functions changes Threat Culture among other actions.

So the new culture takes effect I need to refresh the current page
preserving the URL which can contain URL parameters (query).

I tried 2 solutions:

Dim refreshURL As String = this.GetType().Name
Response.Redirect(refreshURL.Replace("_", "."))

ERROR:
Name 'this' is not declared.

'this' is the C# keyword; as you're using VB.NET, you'd use the word 'Me'
instead
AND

Response.Redirect(Request.Url.AbsoluteUri)

ERROR:
Redirection limit for this URL exceeded.
Unable to load the requested page.
This may be caused by cookies that are blocked.

this is an infinite loop because you're pry doing this every time the page
is loaded (not checking IsPostBack, or somehow preventing the loop on a
GET request).

I'm curious that you'll get the same error if you fix the 1st solution as
well. I think the wrong keyword is keeping you from getting the same
error there.
 
S

Shapper

Yes you are right.

I got the same error as soon as I changed This to Me.

"This is an infinite loop because you're pry doing this every time the
page is loaded (not checking IsPostBack, or somehow preventing the loop
on a GET request)."

How can I solve this?

Thanks,
Miguel
 

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,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top