|
exactly OR display Page ca;t be displayed!....
Currentlly when the user logout my app ad click back button on the browser he'll still be able to view the data.
|
|
|
|
|
Ok , What you need to do, is that When He Successfully logged in , you need to store his username on the Session e.g
if(Success)
{
Session["Username"] = "The Username";
}
this code should in your Login Button , and when the User Decides to Logout , then You need to clear the Session , e.g
Session["Username"] = null;
Now on the Page load event of every page , you need to Check if the User has logged in , if the Session is Null, it means that the user has not logged in, then you can Redirect that user to the Login page. e.g
if(Session["Username"] == null)
{
Response.Redirect("Login.aspx",false);
}
make sure that this code is not inside a code like this
if(!page.ispostback)
{
}
Keep it outside , so that it will always check it.
Hope this helps
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
jrahma wrote: If I want to destroy a page from my website and display (Page Can't be displayed)! if user trued to browse after he sign out my web site using my sign out button.
Your question is not worded properly. But, as per your question, what I understood it, If user sign out from your application, you don't to revisit the page again and insted of that you want to show "Page Can't be displayed"
Use Session.Abandon() when user sign out from your application.
and check the Session Variable for null on the page_load in your page, if it's null, redirect to "can't displayed page"
as,
If(Session["UserName"] == null)
{
Response.Redirect("PageNotDisplayed.aspx");
}
else
{
}
|
|
|
|
|
Well, browers back button does not reloads the whole page and so I have to disagree with other replies about clearing the session. It happens, because of browser cache and you need to clear that out after logout.
Try:
code for clearing cache can be put up in code behind as follows:
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetExpires(DateTime.UtcNow.AddHours(-1));
Response.Cache.SetNoStore();
You can add somethin similar in form aspx if you want to place it there:
<META Http-Equiv="Cache-Control" Content="no-cache">
<META Http-Equiv="Pragma" Content="no-cache">
<META Http-Equiv="Expires" Content="0">
OR
You can clear browser history through JavaScript....
<SCRIPT LANGUAGE=javascript> { var Backlen=history.length; history.go(-Backlen); window.location.href=page url }</SCRIPT>
OR
Page.ClientScript.RegisterStartupScript(this.GetType(),"cle","windows.history.clear",true);
OR as you say in you logout event:
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>");
}
Had you searched this very site 'Question & Answer' section, you would had found this answer.
|
|
|
|
|
Sandeep Mewara wrote: browers back button does not reloads the whole page and so I have to disagree with other replies about clearing the session
He didn't mentioned it any where that, he want to navigate it using browser back button. So, I don't think other answer are wrong. Yes, On back button it's never reload the page, but what about copy the previous url and paste it in different tab ?
BTW: your answer is well explained +5, I will suggest you to put it as Tips n Ticks in CP and in future you / we can use the same from there
|
|
|
|
|
Abhijit Jana wrote: He didn't mentioned it any where that, he want to navigate it using browser back button
Here[^]... he explained it while discussing the previous answer. I won't blame you or other answerers for the session thing as OP failed to explain his problem properly in the first place itself.
Abhijit Jana wrote: BTW: your answer is well explained +5, I will suggest you to put it as Tips n Ticks in CP and in future you / we can use the same from there
Sure, why not.
OT: So, how are you. Looks like, a lot busy these days giving tech-talks..
|
|
|
|
|
Sandeep Mewara wrote: I won't blame you or other answerers for the session thing
Sandeep Mewara wrote: OT: So, how are you. Looks like, a lot busy these days giving tech-talks..
Yes, kind off.
Dude, Tomorrow traveling to Pune for first Indian Code Project Member meet. We will miss you there. Thoug very less number of people and it's an unofficial meet still we will make something big next time and hope to see you there.
Why you are not in gtalk now a days ?
|
|
|
|
|
Abhijit Jana wrote: Dude, Tomorrow traveling to Pune for first Indian Code Project Member meet. We will miss you there. Thoug very less number of people and it's an unofficial meet still we will make something big next time and hope to see you there.
Hey, thats wonderful. Hope you guys enjoy to fullest. Mere naam pe kuch kha/pee lena
Aur haan, don't forget to capture the things... atleast virtually we can attend
Abhijit Jana wrote: hope to see you there.
Why you are not in gtalk now a days ?
Don't ask. Lots of work and office mein gtalk pe rehte hi nahi. Further, once I am back at home (like now), I avoid logging into gtalk. Hopefully, January se atleast login kar payenge... till then you will still don't find me online there.
|
|
|
|
|
Sandeep Mewara wrote: Mere naam pe kuch kha/pee lena
Sure
Sandeep Mewara wrote: don't forget to capture the things... atleast virtually we can attend
Sure. My digi cam is on charge
|
|
|
|
|
Will wait for the snaps!
BTW, as you said, posted it[^] right away.
|
|
|
|
|
I Voted and Bookmarked !!
|
|
|
|
|
Hi all,
I am using a windows application.In that i am using a tab control.
My problem is as in web application there is a control multiview in which we can show only one view at a time.Similar to this in tabcontrol in one tabpage i.e., inside of that tabpage i want to use a control like multiview as my application is a windows application.
Thanks in advance.
|
|
|
|
|
You are at worng Place. This forum is for web only. Post in appropriate forum
|
|
|
|
|
Is there any way to pass variables between asp pages other than the query string? something like what i am doing in WinForm:
form1 myform = news form1();
form1.myvar = "abc123";
what i want is to pass the variale but i dont want it to be shown in the url...
|
|
|
|
|
You are asking an awful lot of questions (here and in Database) which with a little bit of research you could answer yourself. The quesiton above is basic HTML stuff.
Enough now. Do some work yourself.
|
|
|
|
|
|
Better to use POST in the form's ACTION property to just pass values from one page to another.
|
|
|
|
|
- Get HTTP POST information from the source page.
- Use session state.
- Create public properties in the source page and access the property values in the target page.
- Get control information in the target page from controls in the source page.
See MSDN[^] for more details on each.
|
|
|
|
|
I want to know how can I determine what was the back page using C#?
|
|
|
|
|
A simple search found this article. It's vb, but that shouldn't be too hard to convert.
Clickey!!!
I wasn't, now I am, then I won't be anymore.
|
|
|
|
|
|
|
Hi
I created website in ASP.NET 2.0 and MYSQL.
MYSQL data base is at remore server. I can connected to MySQL successfully but when I upload my site to Share hosting, it throws following error.
I think ,On my local m/c I have installed MYSQL management tool so I can connect successfully but on shared hosting, it may not so this error is coming,
Any clue how can we enable our remote shared host to connect to MYSQL.
[MySqlException (0x80004005): Unable to connect to any of the specified MySQL hosts.]
MySql.Data.MySqlClient.NativeDriver.Open() +1142
MySql.Data.MySqlClient.Driver.Open() +69
MySql.Data.MySqlClient.Driver.Create(MySqlConnectionStringBuilder settings) +89
MySql.Data.MySqlClient.MySqlPool.CreateNewPooledConnection() +11
MySql.Data.MySqlClient.MySqlPool.GetPooledConnection() +257
MySql.Data.MySqlClient.MySqlPool.TryToGetDriver() +117
MySql.Data.MySqlClient.MySqlPool.GetConnection() +113
MySql.Data.MySqlClient.MySqlConnection.Open() +309
System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection, ConnectionState& originalState) +31
System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +112
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +287
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) +92
ASP.test_aspx.getuser() in d:\hosting\5454799\html\Testing\test.aspx:25
ASP.test_aspx.Page_Load(Object sender, EventArgs e) in d:\hosting\5454799\html\Testing\test.aspx:12
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +50
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesA
Bajrang Singh
Using .net 2.0 (VS2005)
|
|
|
|
|
how to determine which update panel cause partial postback if i have 2 or 3 update panel. i want to determine this from javascript and server side also. please help me with sample code.
tbhattacharjee
|
|
|
|
|
THIS[^] article is based on to find out which control made postback to page. You might get some hints out of it.
Regards,
Hiren.
Microsoft Dynamics CRM
"A SQL query goes into a bar, walks up to two tables and asks, "Can I join you?", "yes naturally""
|
|
|
|