Response.Redirect()/Server.Transfer issue (RESENDING THIS WAS LOST!)

K

KK

Hi,

In my ASP.NET application I use forms authentication.
if a user tries to go to a page which is in the secured
location he will be directed to the login page.

Upon authorization, he will be redirected to the
RETURNURL using

FormsAuthenticate.RedirectFromLoginPage("*",false);

1) What I want to get done is redirect him to a page
I need. but I can't replace the value in RETURNURL
because its readonly. I just can't do a
Response.Redirect or Server.Transfer without using
FormsAuthenticate.RedirectFromLoginPage() because
then it keeps on loading the logon.aspx page in a loop.

2) Upon logout button click I do a
response.redirect to the logon.aspx and I clear off
the session and the authentication ticket. Because my
application has a frameset when I perform the
Response.redirect() it loads the logon.aspx page
on that frame. How can I break the frames and then
redirect using code?

regards
KK
 
G

george d lake

#2
Add this to the beginning of your HTML in the login Page

<%If Request("bname") <> "" Then%>
<script language="javascript">
top.location.href = 'login.aspx';
</script>
<%End If%>

The Request("bname") can be any var that you know has no data in it. I did
this so when the session times out and the page refreshes due to a submit or
something, it forces the login screen in a full screen and not in an iframe

#1
In login page code behind

Dim returnUrl As String = Request.QueryString("ReturnUrl")
If returnUrl Is Nothing Then
returnUrl = "Default.aspx"
End If
Server.Transfer(returnUrl)
Response.End()

Hope this works.
 

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

Top