Search EggHeadCafe's Job Board
EggHeadCafe Silverlight WPF ASP.NET VB.NET C# Excel SQL Server SharePoint
search
MicrosoftArticlesForumsFAQs
C# .NET
VB.NET
Visual Studio .NET
ADO.NET
Xml / Xslt
VB 6.0
.NET CF
GDI+
LINQ
Deployment
Security
FoxPro
Silverlight / WPF
Entity Framework
RIA Services

WebArticlesForumsFAQs
JavaScript
ASP
ASP.NET
WCF

DatabasesArticlesForumsFAQs
SQL Server
Access
Oracle
MySQL
Other Databases

OfficeArticlesForumsFAQs
Excel
Word
Powerpoint
Outlook
Publisher
Money

Non-MicrosoftArticlesForumsFAQs
NHibernate
Perl
PHP
Ruby
Java
Linux / Unix
Apple
Open Source

Operating SysArticlesForumsFAQs
Windows 7
Windows Server
Windows Vista
Windows XP
Windows Update
MAC
Linux / UNIX

Server PlatformsArticlesForumsFAQs
BizTalk
Site Server
Exhange Server
IIS

Graphic DesignArticlesForumsFAQs
Macromedia Flash
Adobe PhotoShop
Expression Blend
Expression Design
Expression Web

OtherArticlesForumsFAQs
Lounge
Subversion / CVS
Ask Dr. Dotnetsky
Active Directory
Networking
Uninstall Virus
Job Openings
Product Reviews
Search Engines
Resumes

 

  View Other Visual Studio .NET Posts   Ask New Question  Ask New Question With Power Editor

Clear Browser history,asp.net with C#
Saurabh ...... posted at Saturday, September 06, 2008 8:26 AM

how to clear the bowser history using c#

i m unable to call javascript function "windows.history.clear"  form serverside.

 

Reply    Reply Using Power Editor
  Rank Winnings Points
November 0 $0.00 0
October 0 $0.00 0
Use Javascript
Sanjay Verma provided a rated reply to Saurabh ...... on Saturday, September 06, 2008 8:43 AM

Try this one ::

Yes, you can clear browser history through javascript....

//clears browser history and redirects url

<SCRIPT LANGUAGE=javascript>
{
  var Backlen=history.length;   history.go(-Backlen);
  window.location.href=page url
 }
</SCRIPT>

Also see this link :: http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/Q_23052591.html

Hope it helps

Reply    Reply Using Power Editor
Asp.Net Developer
  Rank Winnings Points
November 0 $0.00 0
October 0 $0.00 0

try this
ram kumar provided a rated reply to Saurabh ...... on Saturday, September 06, 2008 12:46 PM

Hi,

 

protected void LogOut()
   {
       Session.Abandon();
       string nextpage = "Logoutt.aspx";
       Response.Write("<script language=javascript>");

       Response.Write("{");
       Response.Write(" var Backlen=history.length;");

       Response.Write(" history.go(-Backlen);");
       Response.Write(" window.location.href='" + nextpage + "'; ");

       Response.Write("}");
       Response.Write("</script>");

   }

Reply    Reply Using Power Editor
  Rank Winnings Points
November 0 $0.00 0
October 0 $0.00 0

U cannot do that with javascript
Binny ch provided a rated reply to Saurabh ...... on Saturday, September 06, 2008 1:16 PM

You cannot clear the existing history but you can make sure a newly 
selected page replaces the previous one preventing building up a
history. You do so by calling
location.replace('newPage.htm');
instead of assigning
location.href = 'newPage.htm';
The location.replace('url') call will replace the current page in the
history list with the new page thus preventing backing to the current
page.
You might also use that in a link with
<A HREF="newPage.html"
ONCLICK="location.replace(this.href); return false;"
>new page</A>

Reply    Reply Using Power Editor
  Rank Winnings Points
November 0 $0.00 0
October 0 $0.00 0

call java script function from server side
Sat Sat replied to Saurabh ...... on Sunday, September 07, 2008 3:07 AM

on button click write down 

string str = "<script>windows.history.clear() ; </script> "

Page.RegisterClientScriptBlock("xxx",string);

This will register a script while rendering at the end of page .
you can refer
http://www.revenmerchantservices.com/ajax/RegisterClientScriptBlock.aspx

Reply    Reply Using Power Editor
  Rank Winnings Points
November 0 $0.00 0
October 0 $0.00 0

Deleting history of browser? Please don't do this.
Eriawan Kusumawardhono provided a rated reply to Saurabh ...... on Sunday, September 07, 2008 11:49 AM

Hi,

Although IE has the ability to delete the browser's history, I advice you not to do this!

Browser history is not just your web page history, it also can contain other web page history, not just yours. If your web page is opened side by side with other web pages from other sites especially ecommerce or portal sites, you'll upset your user if you clear the browser history! After history cleared, the browser has no ability to do its client page state management that goes with the history.

If you don't want to deal with browser history, you can simply make the web page's of your web application session to be expired for a very short time.

Eriawan
Reply    Reply Using Power Editor
An ordinary software developer that mingles with .NET 2.0, WPF, WCF, WF and currently making his way thru .NET 3.5. Very addicted to the latest happening on Microsoft software development tool such as Visual Studio.
  Rank Winnings Points
November 0 $0.00 0
October 0 $0.00 0

try this.
Vasanthakumar D provided a rated reply to Saurabh ...... on Monday, September 08, 2008 12:33 AM

Hi,

try the belwo one..

Page.ClientScript.RegisterStartupScript(this.GetType(),"cle","windows.history.clear",true);

Reply    Reply Using Power Editor
  Rank Winnings Points
November 0 $0.00 0
October 6 $42.00 145