|
I need to write an article, I answer this twice a day.
Write a base class for your pages that require login. In this base page, if the Session does not contain the value that shows someone is logged in, redirect to your login page.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
CG I request You To write an article on this .. because most of the beginners face this problem
If You win You need not Explain............
But If You Loose You Should not be there to Explain......
|
|
|
|
|
I just don't understand why so many beginners are working on secure websites that require this functionality
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
i have tried with base page but this does not serve my purpose as user can still see the previous page. As i have specified that on click of back button i dont want user to view data.
i have maintained session check on each page to prevent users for performing any operation.
Requirement being the user should not be able to view any previous page.
example secure site like(citibank site or gmail etc).
can anybody provide sample code.
thanks in advance...
Regards,
Shraddha
|
|
|
|
|
hey shraddha for time being use window.history.go(+1); This will prevent user from going back i know its not reliable ..
still can be used ...
Try it
If You win You need not Explain............
But If You Loose You Should not be there to Explain......
|
|
|
|
|
i have tried with this also. ie history.go(1); but it again does not serve my requirement. kindly let me know if you find any solution. Thank you...
|
|
|
|
|
shraddha1904 wrote: i have tried with base page but this does not serve my purpose as user can still see the previous page.
Then you screwed it up. This always works for me.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
My logout option is available in all the pages. this is a part of the banner as a user control. hence i cant place in the user control.
history.go(1);
if there is a just one Page for signout then this works. otherwise throughout the application it prevents me from going to the previous page using the back button (even though the user is not logged out).
i have even tried this using Javascript code on logout, but this doesnt work.
protected void Logout_Click(object sender, EventArgs e)
{
Session.Abandon();
string sScript = " history.go(1); ";
if (!Page.ClientScript.IsStartupScriptRegistered("privacy"))
Page.ClientScript.RegisterStartupScript(typeof(Page), "privacy", sScript);
Response.Redirect("Login.aspx");
}
Please Help !!
|
|
|
|
|
Shraddha i am also frustrated ..with this .... I am also facing the same problem if u get answer send to mr.sindhutiwari@yahoo.com
If You win You need not Explain............
But If You Loose You Should not be there to Explain......
|
|
|
|
|
If you have the same problem, you can solve it the same way I told the OP to.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Why dont you try the following
Put Session.Abandon(); in the logout event <b>THEN</b>
on everypage put the following:
if (Session.Count <1)
{
response.redirect("login.aspx")
}
|
|
|
|
|
I told him 2 hours ago to do this via a base class.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I see you explaind a similar thing, I thought if I posted as well he might get it to work
|
|
|
|
|
This is bizarre. What on earth does this have to do with what I told you would solve your problem ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
how to get RichTextBox in .net with c#.any one know the answer replay to me.......
|
|
|
|
|
What does tis have to do with ASP.NET ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
WE have a html control for it ... and if u want to access it in c# code write runat="server" in the tag
If You win You need not Explain............
But If You Loose You Should not be there to Explain......
|
|
|
|
|
currently i m using asp.net with C# (.net 2005, 2.0 framework).
here i m trying to upload an excel content to my database (sql server 2000).i have achieved it. but my excel sheet (column B) consist of ID's (primary key). there may be a chance to be of, getting the same value in excel sheet (Primary key violation).
I need the help from u pals!
1. how can i intimate the user while he entering a value again in a particular column (say, column B) in excel sheet.
2. or while user trying to upload the content i want to intimate him the values repeated and delete the multipl occurances.
How to proceed this? -KARAN
|
|
|
|
|
1 - what do you mean ?
2 - I'm still not sure what you mean, but you can run Excel on the server and control it through C# to examine a spreadsheet and/or change it.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
currently i m using asp.net with C# (.net 2005, 2.0 framework).
while i m uploading my excel sheet to sql server database, i consider the "column B" (in excel sheet) values as primary key (in database also i set the primary key constrain. Now if user enter Column B2 as "1336" and column B3 as "1336" then error will occur while uploading(Primary key violation). to avoid this i m trying to follow the below two ways....
1. To intimate the user while he entering a repeatative value in a particular column (say, column B) in excel sheet. (a prompt message should be shown to the user while he entering 1336 value in Column B2 and B3)
2. Or while user trying to upload the I like to prompt him the values repeated and also automatically delete the repeatative occurance (i.e Column B3) by my coding
How to proceed this? -KARAN
|
|
|
|
|
I want to generate UserID from the Website when ever new user want to create account that time user have to provide userID its own choice.
that time userid is to check with sql database if the same userID is already exists then Website Give The choice of 3 Or 4 AutoGenerated UserId which is available.
or which is not provided yet.
so it is available...
i want to Autogenerate that userID which is made by user's other information like Fristname,Lastname,Bithdate etc....
|
|
|
|
|
The SQL check is obviously trivial, the main thing is to come up with algorithms such as grabbing the first letter of the first name, appending the surname, and then adding numbers if necessary to create a possible username. The string class has a substring method you can use for this, or you can use myStringt[0] to get just one character ( the first, in this case ).
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
i m bigginer in asp.net,
i made website with login control,
suppose I want logout from current page i will click on button logout and them time i securly logout but after logout i click on Internet Explorer Browser's BACK Button that time my page go to on last visited page and it show already login page,
But i really want to do at that time my login page is show request to user to do login for visiting website.
please help me in this situation ,....
as i told above I m bigginer of asp.net and I make login control as my own way means manually.
and i already try to session close and
FormsAuthentication.SignOut()<br />
Session("uid") = 0
but its not working..
|
|
|
|
|
If you are looking at an old page and then when you try to interact with it, it logs out, then you're looking at a cached page. You can mark your pages not to cache. If you can still interact with the page, then you need to add code to stop that happening. I typically write a base class for all my pages that checks the Session("uid") value and redirects to my login page if it tells me the user is not logged in
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hello,
I have cribbed an HttpHandler class to protect certain files on my website, very much along the lines of this article[^]...
(in fact extended to include Word docs, Zip files etc, but the essential code is the same.)
All works fine but for one thing:
If a logged-in user clicks a link to, say, a Word doc, it will open in a new window, and they can then use "File/Save As.." to download it onto their computer. That's fine. But if they right-click the link and choose "Save target as.." and try to save it like that, they will get an "Access denied" message (or "no.jpg" in the example code I linked to.)
What do I need to alter in the code to allow this, without compromising the rest of it?
Presumably, right-clicking means that context.Request.ServerVariables["HTTP_REFERER"] returns null/Nothing.... what else could I use to check for this?
thanks for any ideas..
P
|
|
|
|