Visual Studio .NET - Clear Browser history,asp.net with C#
Asked By Saurabh ......
06-Sep-08 08:26 AM
how to clear the bowser history using c#
i m unable to call javascript function "windows.history.clear" form serverside.
Use Javascript
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
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
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
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.
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.
Hi,
try the belwo one..
Page.ClientScript.RegisterStartupScript(this.GetType(),"cle","windows.history.clear",true);
Wise for Visual Studio.NET Wise for Visual Studio.NET By Peter A. Bromberg, Ph.D. To "Print This Page" Link Peter Bromberg Wise for Visual Studio .NET is a total and complete installation development system for creating and editing Windows® Installer
Visual Studio.NET: Help Yourself! Visual Studio.NET: Help Yourself! By Peter A. Bromberg, Ph.D. Peter Bromberg I'm constantly annoyed by the number of developers using Visual Studio.NET who don't seem to see the need to create decent documentation for their
Migrating to Visual Studio.NET 2003: A Developer Perspective Migrating to Visual Studio.Net 2003: A Developer - oriented analysis By Peter A. Bromberg, Ph.D. Printer - Friendly Version Peter Bromberg A new Platform On April 24, 2003 Microsoft Windows Server 2003 and Visual Studio .NET 2003 are officially released. Many developers and beta testers (myself included) have been feverishly
Need Visual Studio .NET 2005 tutorials sites Hi, Can some one send some sites to learn Visual Studio .NET 2005.Need some tutorials. . Thanx in advance Visual Studio 2005 Hands-On Tutorial http: / / www.15seconds.com / issue / 060427.htm Introduction to Visual Studio
Visual Studio .NET 2008 - Speed Up XAML Load Times Do your XAML files load up in Visual Studio .NET 2008 as slow as mine? Here is a workaround that might help. Visual Studio .NET 2008 is an extreme disappointment for me. Its performance is attrocious and the XAML