Back Button Problem in ASP.NET After Logout

I was facing a problem during one of my project. Actually, I was developing an E-Commerce site, in which I need to give login and logout button. I did login part easily and logout also. But problem arisen, when I pushed back button. Oh! God! Even after logout, it creates a session without login. How? I put all code behind ‘Logout’ button. But still I was facing the problem. We saw many codes, tried a lot of way to logout but still back button is not disabled.
One easy way to solve this problem is applying javascript. It would not allow a person to go back to that page. But, is it a feasible solution? NO! One would like to go back, even after logout to see something. This javascript would disable to come back. So, that is not a proper solution.
So, here I am writing the proper code, which we finally found out and happy news is that, “It really works!”. So just follow this code.
If you applying a MasterPage, then copy these codes to its page load, or copy to that page’s load, which comes after login page or comes before logout page.
pic11
And on logout button click, write these codes.
piv23>
So, if you still getting some kind of problem, please leave comment.
If you liked this article, please rate and comment. Thank You!

Signature

Deepesh Singh
logo

Sending mail through ASP.NET

In this topic, I want to give a tutorial: How to send mail with the help of ASP.NET. Through these codes, you can make your own mail transfer system. Actually you are building a mediator, which helps another account and password to forward your mail to given id. Before writing this code, please get your port id. Like for Google/ Gmail its 587. Here I am gonna use my gmail account. Lets see.

First make a page. Say contact.aspx.

contact.png

Make a button, ay Submit. And on click, write these codes. And add these library to your cs file. So lets create contact.aspx.cs page.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net;
using System.Net.Mail;
contact.aspx.cs

In place of “mypassword” give your password for the mail id you are using to send (I used deepeshsingh09@yahoo.com). Any query, drop a comment.

Signature

Deepesh Singh
logo