adding a second forumhttp://forums.asp.net/t/1636636.aspx/1?adding+a+second+forumMon, 10 Jan 2011 13:53:16 -050016366364226568http://forums.asp.net/p/1636636/4226568.aspx/1?adding+a+second+forumadding a second forum <p>Hi all, I am still a noob at c#.net, but have been kicking around the beer house for a little while now. I have set up a web site using the beer house where members can register. The problem that I have is I written a book on the subject of my web site and want to add a closed forum (layer?) that only people that have purchased my book can access. I am using vwd 2008 3.5 but cant figure out the UI, BLL, DAL DATASTORE. Can anyone offer some advice as to how I can add another layer to the forum section of the beer house. thanks in advance.</p> <p><span class="" style="font-size:x-small; font-family:"></span></p> <p>&nbsp;</p> <p>&nbsp;</p> 2010-12-27T09:17:22-05:004226637http://forums.asp.net/p/1636636/4226637.aspx/1?Re+adding+layers+to+the+forumRe: adding layers to the forum <p>It's not a layer that you need. You should look at authentication for protecting a certain part of the site from unauthorised users. Have a look at Chapter 4 again.<br> </p> <p><br> </p> 2010-12-27T10:03:33-05:004226680http://forums.asp.net/p/1636636/4226680.aspx/1?Re+adding+layers+to+the+forumRe: adding layers to the forum <p><font size="2"></p> <p>I think maybe we are misunderstanding each other. I have built a site and do have a membership that you have to be registered for, in which I give some free lessons, but I want to add a side forum that is only accessible to the people that have bought my book</p> </font> <p></p> 2010-12-27T10:36:45-05:004226754http://forums.asp.net/p/1636636/4226754.aspx/1?Re+adding+layers+to+the+forumRe: adding layers to the forum <p>So basically, you need to use Roles. These define what people are allowed to do. You already have two - anonymous users who can browse the unrestricted parts of the site, and basic members, who can access your free lessons. You need a third - paid members who can access more valuable content.</p> <p><a href="http://weblogs.asp.net/scottgu/archive/2006/02/24/ASP.NET-2.0-Membership_2C00_-Roles_2C00_-Forms-Authentication_2C00_-and-Security-Resources-.aspx">http://weblogs.asp.net/scottgu/archive/2006/02/24/ASP.NET-2.0-Membership_2C00_-Roles_2C00_-Forms-Authentication_2C00_-and-Security-Resources-.aspx</a><br> </p> <p><br> </p> <p><br> </p> 2010-12-27T11:35:26-05:004229452http://forums.asp.net/p/1636636/4229452.aspx/1?Re+adding+layers+to+the+forumRe: adding layers to the forum <p><span class="" style="font-size:medium; font-family:"><span class="" style="font-size:small; font-family:"></p> <p><span class="" style="font-size:large; font-family:"></span></p> </span></span> <p>&nbsp;<font size="3"><font size="3">Yes, you have the idea but, anonymous users can also read the registered forum, they just can post to it. What I would like to do (if this is possible) is for any user to click on the forum menu link and be able to see what is available. If you are familiar The Beer House SDK, when you click on the menu link for the forum it opens the ShowForums.aspx page that shows a series of databound links. I would like for some of the links to redirect unauthorized users to a new page explaining the restrictions. This way the more restricted members would also be able to read and post to the registered forum. Registered members could read and post, but could not access the more restricted pages and anonymous users could read some of the forum but not access the more restricted pages. </p> <p></p> <p>Could I use the link on the show forums page to send the user to a blank page with a 301 redirect and from there to the explanation page or take the user to the more restricted content? I dont know what all is available. Thanks again </p> </font></font> <p></p> <p><span id="_marker">&nbsp;</span></p> <p><span id="_marker">&nbsp;</span></p> <p></p> <p></p> <p>&nbsp;</p> <p>&nbsp; </p> <p>&nbsp;</p> <p>&nbsp;</p> <p>&nbsp;</p> 2010-12-29T07:39:20-05:004231876http://forums.asp.net/p/1636636/4231876.aspx/1?Re+adding+a+second+forumRe: adding a second forum <p><span class="" style="font-size:small; font-family:"></p> <p>I did it! I did it! I did it! I cant believe it. I have been working on this longer than I want to think about. What a great way to start the New Year.</p> <p>I read and reread and reread chapter 8 of The Beer House book. There I found in the showThread.aspx section This page renders a paginable grid showing all posts of the thread, whose ID is passed on the querystring. </p> <p>So I viewed the ~\BrowseThreads.aspx in a browser and saw in the address bar the ForumID=7. I noticed the QueryString&nbsp;had a different ForumID for each section of the forum. So I went to the code behind for the BrowseThreads.aspx and converted the ForumID to a variable with this line</p> </span> <p></p> <p><span class="" style="font-size:small; color:#0000ff; font-family:"><span class="" style="font-size:small; color:#0000ff; font-family:"><span class="" style="font-size:small; color:#0000ff; font-family:"><span class="" style="font-size:small; color:#0000ff; font-family:"><font color="#0000ff" size="3"></p> <p></font></span></span></span><span class="" style="font-size:small; font-family:">&nbsp;</p> <pre class="prettyprint">string forumID = this.Request.QueryString[&quot;ForumID&quot;];</pre> <p><br> &nbsp;</span>I put it in the Page_Load event and tested the IsInRole with an if statement and upon failure I redirected to a new page. The whole code looks like this.</span></p> <p><span class="" style="font-size:small; color:#0000ff; font-family:">&nbsp;</span><span class="" style="font-size:small; color:#0000ff; font-family:">public partial class BrowseThreads : BasePage<br> &nbsp;&nbsp;&nbsp; {<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; protected void Page_Init(object sender, EventArgs e)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gvwThreads.PageSize = Globals.Settings.Forums.ThreadsPageSize;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br> <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; protected void Page_Load(object sender, EventArgs e)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!this.IsPostBack)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong>string forumID = this.Request.QueryString[&quot;ForumID&quot;];<br> <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (forumID == &quot;The Number In The QueryString&quot; &amp;&amp; !this.User.IsInRole (&quot;The Role&nbsp;Your Using&quot;))</strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br> <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong>{<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Response.Redirect(&quot;To New Page.aspx&quot;);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br> </strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br> } </p> <p></p> <p></p> <p></p> <p></p> <p>With this code you can create as many new restricted forums as you want. You will have to include the administrator and anyone else that should have access to this page by adding their name to the &quot;role you are using&quot; Happpy New Year!!!&nbsp;<br> </p> <p></p> <p></span>&nbsp;</p> <p></p> 2010-12-30T16:56:12-05:004246348http://forums.asp.net/p/1636636/4246348.aspx/1?Re+adding+a+second+forumRe: adding a second forum <p>Kewl...&nbsp;&nbsp;I will have to give it a try when I get that far in the book.&nbsp;</p> <p>Thanks for sharing that Jim.</p> 2011-01-10T13:53:16-05:00