Reply
Redirection
Old 03-30-2006, 03:52 AM Redirection
waller's Avatar
Skilled Talker

Posts: 59
Location: North Borneo.
I have this system where Login page is used. Now my problem is, everytime I try to open an .aspx file, it will be redirected to the login page(which is already working). Now the .aspx file that I mentioned is totally blank. Just some html code. so as the Code Behind. Where could the problem be?
__________________
$id ="waxxer";
$id = str_replace('x', 'l', $id);
echo $id;
echo " and Marj";
waller is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
     
Old 03-30-2006, 03:18 PM Re: Redirection
Experienced Talker

Posts: 30
Let me know if these basic steps don't get you where you want to be:

Lets say you have a site with 3 aspx pages: Default.aspx, Login.aspx, SuperSecretInfo.aspx. Lets say you want everybody to be able to view Default.aspx without being logged in, you want them to be able to view SuperSecretInfo.aspx only if they are logged in, and you want them to be directed to Login.aspx if they try to access SuperSecretInfo.aspx without being logged in.

You can do the following:

1) Setup web.config like this (chunks of code removed)...
<system.web>
...
<authentication mode= "Forms">
<forms name="MyCookie" loginUrl="Login.aspx" />
</authentication>
...
<authorization>
<deny users="?" />
</authorization>
...
</system.web>

<location path="Default.aspx">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>

<location path="Login.aspx">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>


2) In Login.aspx code behind (chunks of code removed)...
Private Sub btnLogin_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles btnLogin.Click
if GetUserNamePasswordCorrect(username.text,password. text) then
FormsAuthentication.SetAuthCookie(username.text, False)
Response.Redirect("SuperSecretInfo.aspx")
end if
End Sub


Keith
KeithKrueger is offline
Reply With Quote
View Public Profile Visit KeithKrueger's homepage!
 
Reply     « Reply to Redirection
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.11114 seconds with 13 queries