Solved

Members only section in Website C#

Posted on 2012-03-22
3
235 Views
Last Modified: 2012-03-22
Hi Guys,

I'm building a website using Visual Web Developer 2010 Express with a template I downloaded.  Following microsofts guide (http://msdn.microsoft.com/en-us/library/ff184050.aspx) I made a folder under the root directory named "Account". ("Account" folder by default denies anyone who is not logged in)    In that folder I created a two .aspx pages.

Here's the problem, when I run my site, and login, that works.  Once logged in if I hit page "A",  it works.  Or if I login, then hit page"B", that works also.

The problem is, once logged in, and say I am on Page "A", if I hit the link for page"B", it gives me the following error

The resource cannot be found.
Requested URL: /WebSite1/Account/Account/testMembers.aspx


The problem I think is on the site.master file
      <div id="menu">
            <ul>
                  <li class="first current_page_item"><a href="#">Homepage</a></li>
                  <li><a href="#">Products</a></li>
                  <li><a href="#">Services</a></li>
                  <li><a href="#">Clients</a></li>
                  <li><a href="#">Support</a></li>
                  <li><a href="Account/Login.aspx">About</a></li>
            <li><a href="Account/MembersOnly.aspx">Members Only</a></li>
            <li><a href="Account/testMembers.aspx">Test Members</a></li>
                  <li class="last"><a href="#">Contact</a></li>
            </ul>


But I do not know how to fix this... any suggestions?
.. the path is showing Account twice
0
Comment
Question by:solarissf
3 Comments
 
LVL 7

Accepted Solution

by:
Lalit Chandra earned 500 total points
ID: 37753736
you have 2 choice,
1. If your Account folder is on the root,and the two pages inside it then you have to change the anchor href from
   <li><a href="Account/MembersOnly.aspx">Members Only</a></li>
To
   <li><a href="/Account/MembersOnly.aspx">Members Only</a></li>

   Just Add "/" in the beginning of href;

2. Simple use Asp.net Server control
   <asp:HyperLink NavigateUrl="~/account/MembersOnly.aspx" runat="server">HyperLink</asp:HyperLink>


Hope above will fix your problem
0
 
LVL 51

Expert Comment

by:HainKurt
ID: 37753752
this may also work

<a runat=server href="~/Account/MembersOnly.aspx">Members Only</a>
0
 

Author Comment

by:solarissf
ID: 37753876
the "~/Account" and "/Account" did not work.  But the hyperlink worked, thank you
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This guide will walk you through the essential considerations and tech stack for building scalable websites. Know how to grow your business the smart way!
The purpose of this video is to demonstrate how to manually back up a WordPress Database. This will be demonstrated using a Windows 8 PC. The Host used will be IPage.com Log into your Hosting account. IPage will be used for demonstration : Locat…
The purpose of this video is to demonstrate how to integrate Mailchimp with WordPress, by placing a Mailchimp signup form on a WordPress Page or Post. This will be demonstrated using a Windows 8 PC. Mailchimp will be used. Log into your Mailchi…

786 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