|
I think this is fine. I have used this technique to keep the redirect url in the querystring and it worked perfectly.
Why are you looking for any other solution?
|
|
|
|
|
Thanks Abhishek. I was just checking out whether there are any other options through which to achieve the same.
Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.
|
|
|
|
|
I think You are using for User Approval..!If thts the case Use the below..!
If You are using Forms Authentication..!
You can use of Guid Key..!
Guid UserID = new Guid(Membership.GetUser(User.Identity.Name)).ProviderUserKey.ToString());
Guid key = new Guid(Request.QueryString["id"].ToString());
MembershipUser user = Membership.GetUser(key);
user.IsApproved = true;
Membership.UpdateUser(user);
That is one Way..!
LatestArticle :Log4Net
Why Do Some People Forget To Mark as Answer .If It Helps.
|
|
|
|
|
Thanks. I am not using User Approval. However, it is good information. I can use it for next time.
Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.
|
|
|
|
|
Hi
I am not able encypt web.confige file. I am able to Create a custom RSA key container by running command
C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -pc “MyKeys” -exp
after Specify a protected data provider in web.config file
and running on following command to encypt the web.config file it gives the list of all command related to ASP .NET registration options and my web.config file is not encrypted
C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -pef "SensitiveAccountInfo" "path" -prov “MyProvider”
Please Help me in it.
Thanking You!.
Rock Star
|
|
|
|
|
|
Thanx
I got the solution I juast forgot to set the read permission on provider
Rock Star
|
|
|
|
|
hi,
you can follow the steps as below:
step1: Make sure These are not encrypted,such as
<processmodel>
<runtime>
<mscorlib>
<startup>
<system.runtime.remoting>
<configprotecteddata>
<satelliteassemblies>
<cryptographysettings>
<cryptonamemapping>
<cryptoclasses>
Step 2, Create a RSA key container,
you can use the command :aspnet_regiis -pc "ABeenKeys"–exp
Step 3, Modify web.config to identify the key container
Step 4 , Encrypt the <connectionstrings> section of your web.config file
> aspnet_regiis -pe "connectionStrings" -app "/connectionTest"
modified 27-May-14 5:05am.
|
|
|
|
|
hi all,
in my web application i made a session (Session["UserName"] = tbUserName.text) so it saves value in it if username is correct and redirect the user to mainpage.aspx.
the problem is:-
in login page if i copy the link of main page and paste it in address bar
at the login page it redirects it without even entering any data at Username and password.
i tried to check the session in main.aspx and see if empty redirect user to login which works the first time but as soon as i enter valid username and password in login the problem appear again even when i put the following at logout linkbutton (session["UserName"] = null)
can anyone help!!!!
thx in advance
|
|
|
|
|
loading from cache,clear the cache
add this on page load of all pages
Response.AddHeader("Cache-control", "no-store, must-revalidate, private,no-cache");
Response.AddHeader("Pragma", "no-cache");
Response.AddHeader("Expires", "0");
|
|
|
|
|
|
Ideally, you should destroy Session by calling Session.Abandon() method on logout.
|
|
|
|
|
tried but still the samething.....
|
|
|
|
|
Check Session Value on Page_Load. Check my Answer
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
Then the problem could be with Cache. Did you tried the above solution?
|
|
|
|
|
During Logoff you should use Session.Abandon() to set all session variable to null
and In Page_Load you should check like this
if(Session["UserName"] ==null )<br />
Response.Redirect("Login.aspx");
If you need to learn more about session, please read this article
Exploring Session in ASP.Net[^]
Let me know if you need more help
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
dear Abhijit Jana,
i did what u wrote in fact my code is exactly the same..... but no use.
|
|
|
|
|
That means Session value is not null.
See what is the value of Session.
|
|
|
|
|
Let me first understand the problem here -
First, you had not validated the session on the main page hence when you entered the URL the main page was displayed.
So, you validated the session variable and redirected the user to Login page.
Now on the login page only after you sign-in you are able to go to the main page.
Now you wish to log-out the user for which you use session["UserName"] = null; but the main page still goes thro'.
Am I correct?
The problem here is that you should not use session["UserName"] = null; to remove the session variable. You should use Session.Remove("UserName");
HTH!
|
|
|
|
|
ok...
tried but wont work..
|
|
|
|
|
1. How do you check the Session variable on the main page? If possible post the code here.
2. Does the user actually click the Logout button/link?
|
|
|
|
|
1.) if (Session["UserName"] == null)
{
Response.Redirect("Login.aspx");
}
this in main.aspx page_load
2.)sure and the code to logout is :-
//Session["UserName"] = null;
//Session.Abandon();
Session.Remove("UserName");
Response.Redirect("Login.aspx");
|
|
|
|
|
Did you step thro' and check what happens in the Page_Load on the main page. Check if Session["UserName"] evaluates to null or if it returns any other value.
Are you checking this with-in a IsPostBack check? Can you post the entire Page_Load code?
Can you re-phrase what is happening against what is expected?
|
|
|
|
|
thank u for your consideration but i managed to solve out the problem through emptying the buffer..
|
|
|
|
|
Please check if session is removed properly..
Check
Session.Remove("UserName");
var session = Session["UserName"];
Check what you see in the session variable. If it is null, I think the session is somewhere created. If you can see the value of session, it is indeed not clearing out properly.
Are you using webdev environment. I recommend you to try this in the IIS.
|
|
|
|