Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi all,

 

Ok, when I log out of my application I am going to redirect to a new page, called logout.aspx. This page is responsible for deleting session variable and resetting all other variables. Now I would like to add in a function that 10 second after the page loads the user automatically get redirected to another page, in this case say google.com.

 

Now this is what I was thinking of doing...

1. Loading my page as normal but in the page load() method calling a function called page_Redirect.

2. In the page_Redirect method, I will declare a variable x and let it equal to the current time. I also have a boolean variable which is currently equals to false.

3. I have a while loop that does the following (this is only pseudo code):

dim result as boolean = false
while result = false
  if time = (x+10sec) then
     result = true
     Response.redirect("www.google.com")
  end if 
end while

 

Am I approaching the problem the correct way, or is their a simplier way to do what i want to do.

 

Mike55

A Client refers to the person who incurs the development cost.

A Customer refers to the person that pays to use the product.

------

My software never has bugs. It just develops random features. (Mosabama vbforums.com)

Posted
I would use the FormsAuthentication class for login/logout and use either javascript or insert a html meta refresh tag to do the delayed redirect.

 

Thanks for the reply. Why would you use the FormAuthentication class for logout? Can understand it for the login, and have used it in other projects for the log in.

 

Mike55

A Client refers to the person who incurs the development cost.

A Customer refers to the person that pays to use the product.

------

My software never has bugs. It just develops random features. (Mosabama vbforums.com)

Posted

Mike55,

 

I used the following tag to do the same thing:

 

<head>

<META HTTP-EQUIV="refresh" content="3;URL=http://www.google.com">

</head>

 

number "3" specifies the time in seconds before redirecting.

Posted

Thanks Misha

 

Mike55

A Client refers to the person who incurs the development cost.

A Customer refers to the person that pays to use the product.

------

My software never has bugs. It just develops random features. (Mosabama vbforums.com)

  • *Gurus*
Posted
Using code like this is an awful practice. It can and will annoy the user and mess up the flow of history in the browser. In other words, it will render the back button useless for some less-adept users. Either redirect to a page on the server (which sends a 30[0-4] response code) or don't do it at all.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...