search
Japanese Chinese Nederlands Espanol Italiano Deutsch Francais Twitter Rss Feeds
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

Web ProgrammingArticlesForumsFAQs
JavaScript
ASP
ASP.NET
Web Services

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

DatabasesArticlesForumsFAQs
SQL Server
Access
Oracle
MySQL
Other Databases

OfficeArticlesForumsFAQs
Excel
Word
Powerpoint
Outlook
Publisher
Money

Operating SystemsArticlesForumsFAQs
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
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 
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.

 


 
  Use Javascript
Sanjay Verma replied to Saurabh ...... at 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

 
  try this
ram kumar replied to Saurabh ...... at 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>");

   }

 
  U cannot do that with javascript
Binny ch replied to Saurabh ...... at 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>

 
call java script function from server side
Sat Sat replied to Saurabh ...... at 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

 
  Deleting history of browser? Please don't do this.
Eriawan Kusumawardhono replied to Saurabh ...... at 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
 
  try this.
Vasanthakumar D replied to Saurabh ...... at Monday, September 08, 2008 12:33 AM

Hi,

try the belwo one..

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