locked
Personal Web Site - How do I restrict access to the resume section RRS feed

  • Question

  • User-642874736 posted

    I a a newbie to ASP.net but have experience in VB2005.  Can you tell me how I can restrict access to the "Resume" link when I use the Personal Web Site template (same as is done for the "Albums" section?)  I am using the VB version of the template.

    Thanks so much.

    Roger  [8-|]

    Tuesday, February 27, 2007 7:38 PM

All replies

  • User-2003048288 posted
    Use roles and access rules
    Tuesday, February 27, 2007 9:10 PM
  • User595806616 posted

    I a a newbie to ASP.net but have experience in VB2005.  Can you tell me how I can restrict access to the "Resume" link when I use the Personal Web Site template (same as is done for the "Albums" section?)  I am using the VB version of the template.

    Thanks so much.

    Roger  [8-|]

    In the Web.sitemap you can use the roles property of the Resume link like the following. Just add the roles that can view it.

    <siteMapNode title="Resume" url="Resume.aspx" roles="Family,Registered Users,Administrators" />

     

    Wednesday, February 28, 2007 1:54 AM
  • User-642874736 posted

    The only role I currently have is Administrators.  Even if I don't log on it allows me to go to the Resume page.  Here is my web.sitemap file.  Any advice?

    Thanks,

    Roger 

    <?xml version="1.0" encoding="utf-8" ?>

    <siteMap>

    <siteMapNode title="Home" url="Default.aspx">

    <siteMapNode title="Resume" url="Resume.aspx" roles="Administrators" />

    <siteMapNode title="Links" url="Links.aspx" />

    <siteMapNode title="Albums" url="Albums.aspx" >

    <siteMapNode title="Photos" url="Photos.aspx" >

    <siteMapNode title="Details" url="Details.aspx" />

    </siteMapNode>

    </siteMapNode>

    <siteMapNode title="Register" url="Register.aspx" />

    <siteMapNode title="Manage" url="Admin/Albums.aspx" >

    <siteMapNode title="Photos" url="Admin/Photos.aspx" >

    <siteMapNode title="Details" url="Admin/Details.aspx" />

    </siteMapNode>

    </siteMapNode>

    </siteMapNode>

    </siteMap>

    Wednesday, February 28, 2007 5:07 PM
  • User595806616 posted

    Actually you really only need this if you want to allow access to Authenticated Users only. Add the following at the bottom of the web.config just above the </configuration> tag.

    <location path="Resume.aspx">
    <
    system.web>
    <
    authorization>
    <
    deny users="?" />
    </
    authorization>
    </
    system.web>
    </
    location>

     

    Wednesday, February 28, 2007 11:17 PM
  • User-642874736 posted
    Thank you so much!!!  (Any recommendations for books so I can try to figure this stuff out for myself?)
    Saturday, March 3, 2007 4:41 PM
  • User-1976489802 posted

    Hi,

    I was just following this and I pasted the text where you said to, but then when I load the page in the browser, the 'Resume' link dissapears. When I remove the code that you have provided and load the page, the 'Resume' link re-appears. What will solve this problem? 

    Sunday, April 15, 2007 11:25 PM
  • User595806616 posted

    The purpose of that code is to only allow access to users that are logged in. If you want to be able to let people see the link but not access it unless they are logged in, you can use code in the page load of the Resume page.

    If HttpContext.Current.User.Identity.IsAuthenticated = False Then
         Response.Redirect("~/Login.aspx")
    End If

     

    Monday, April 16, 2007 12:22 AM