Redirect to login page with ReturnUrl

Joined
May 20, 2009
Messages
1
Reaction score
0
Hi, I'm from Argentina,

When entering a page (let's call it Page A), if user is not authenticated, I want to redirect him to login page with ReturnUrl to Page A. A solution could be to deny page A in web.config but can't do that because there's also a datetime condition to allow or deny unlogged users.

Here's the code in the page load of Page A:

if (pub.creacion > DateTime.Now)
{
if (User.Identity.IsAuthenticated)
{
usu.id = User.Identity.Name;
usu.recuperar();
}
else
{
Response.Redirect("../gral/login.aspx?ReturnUrl=" + CQueryString.GetEncryptedQueryString("id=" + this.SecureQueryString["i"]));

This line above has the error. I want to redirect to login page with ReturnUrl to Page A (this page)

}

}


Page A has query encription ----> CPublicacion pub = new CPublicacion(long.Parse(SecureQueryString["id"]), true );


Any ideas ??
Thanks !!
 
Joined
Mar 4, 2009
Messages
17
Reaction score
0
Read the query string portion from the below thread. The solution is use server.urlencode&encode.

shawpnendu.blogspot.com/2009/04/passing-dataparametersvalues-from-one.html

Dont forget to rank this post if its help you.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top