Solved

LoginStatus control

Posted on 2012-03-20
2
350 Views
Last Modified: 2012-06-22
I have a LoginStatus control on my site.

On logging out, on some pages, it will redirect like I want it to (those that require a user to be logged in) and on others it just refreshes the page. This is what I want.

What I want to know is "how do I add pages to the list of pages that require a user to be logged in?" On some of my newer pages it isn't redirecting them when it should. That is, they are supposed to be logged in to view that page.

I don't remember adding pages, it just seems to have known.
0
Comment
Question by:ce4LessUser
2 Comments
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 37748002
Some code might help.


Cd&
0
 
LVL 13

Accepted Solution

by:
Molnar István earned 500 total points
ID: 37877760
you can add pages that require an authentication using the web.config like this:
<!--SECURITY: USERS-->
    <location path="userprofile.aspx">
        <system.web>
            <authorization>
                <deny users="?"/>
                <allow users="*"/>
            </authorization>
        </system.web>
    </location>
<!--SECURITY: ADMINISTRATORS-->
    <location path="managecategories.aspx">
        <system.web>
            <authorization>
                <allow roles="Administrator" />
                <deny users="*"/>
            </authorization>
        </system.web>
    </location>

as for the redirection, you can do :
1. setting the NavigateUrl for the login control
2. using the function : this.Response.Redirect("shoppingcart.aspx", true);

hope it helps
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Batch convert .doc to .docx 13 182
SCCM2012 sp2 CU3 cant see boot images missing tabs 3 60
Run program by typing the .exe in the start>run dialog 5 51
Problem to page 4 74
User Beware!  This is a rather permanent solution to removing your email from an exchange server.  The only way to truly go back is to have your exchange administrator restore your mailbox from backups.  This is usually the option of last resort.  A…
In this article you will learn how to create a free basic website on Bitbucket, a git service provider. Polymer creates dynamic HTML components, which allow more flexibility than static HTML. This tutorial uses Ubuntu Linux but can also be done on W…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now