Dieing on Website Project

RayWind

New member
Joined
Jan 16, 2012
Messages
2
Programming Experience
Beginner
Hello Everyone,
I come to you all in quite a panicked state. I have a massive(in my eyes) project due in a month and a half and I've spent the last month and a half with about 40-50 hours per week working on this but I'm not getting anything actually developed and I'm pretty bad at it so far. I'm a student and I've learned a lot about theory in the past two years, but not a lot of actual development experience thus far. I've written the hello world program in 10 different languages, that's about it. This has illustrated just how far I still have to go to be a real developer.

Project Overview: What we(I say we, but...) are building is a sort of game site on top of a social site. The actual design that we have so far is a few games we're developing (think dice, cards, lottery, "stock market") that simply play on the users "Game Page". We're using vb.net 4.0

Modules I'm attempting to build:
  • Page aware of user ID therefor can print simple things like "Point" amount, and some other lifetime stats
  • a chatbox on the page that can display what any other user on the system types into it
  • an NPC chat box that simply displays strings talking to the user dependant upon actions in the game/point totals/general performance
  • A "achievement" bar that shows feedback as to current players "life style"

For the first item I'm attempting to write logic on the game page that simply can recognize the logged in user and gives me access to his lifetime point totals and stats for simple display. I'm using a Microsoft SQL DB and attempting to read the items I've placed in the aspnet_Users table and I can't seem to get the page aware of the currently logged in user. From MSDN I've read all of the items about state/session and all that but I think the best way is to use a sqlProfile object but even from the examples there I'm able to get anything to work. I'm pretty sure I've found the answer I just can't seem to recognize it.

For the Chat across the site I found the client server example chatter and even got it dl'd and working(by itself of course) however that example has a lot of things in it and unfortunately seems a bit over my head right now so I couldn't find a way to adapt that for my use. Anything here will help.

For the NPC chat box I'm using an update panel and the various buttons on the page just output directly to labels in that panel. The code behind is in the Page Load event but I don't really like that implementation and that panel doesn't seem as responsive as it is in my imagination.

Capture.png


That's the current file structure with the folders implementing roles and just organized that way.

For the Achievement bar I'm basically just using an asp net image and switching it according to some rough randoms but it should have real logic eventually. Sample code below.

VB.NET:
<div id="Cheevsection" class="cheevbar">                 
<asp:Image  ID="Image1" runat="server" ImageUrl="~/LifeImages/carHigh.jpg"  BorderStyle="Solid" BorderWidth="10px" Width="20%" Height="150px" /> 
<asp:Image ID="Image2" runat="server"  ImageUrl="~/LifeImages/carHigh.jpg" BorderStyle="Solid"  BorderWidth="10px" />                 
<asp:Image ID="Image3" runat="server" ImageUrl="~/LifeImages/carHigh.jpg" /> 
<asp:Image ID="Image4" runat="server" ImageUrl="~/LifeImages/carHigh.jpg" />

VB.NET:
Dim points = New Integer         
Dim randomClass As New Random         
points = randomClass.Next(1, 1000)         
If points > 500 Then             
Me.Image1.ImageUrl = "~/LifeImages/homeHigh.jpg"             
Me.Image2.ImageUrl = "~/LifeImages/lifestyleHigh.jpg"             
Me.Image3.ImageUrl = "~/LifeImages/carHigh.jpg"             
Me.Image1.ToolTip = "Life is good look at my big ol' house"             
Me.Image2.ToolTip = "Man I'm Living the Yacht Life Man!"             
Me.Image3.ToolTip = "Look at this fast car"         
ElseIf points < 500 Then             
Me.Image1.ImageUrl = "~/LifeImages/homeLow.jpg"             
Me.Image2.ImageUrl = "~/LifeImages/lifestyleLow.jpg"            
 Me.Image3.ImageUrl = "~/LifeImages/carLow.jpg"             
Me.Image1.ToolTip = "Life is bammer, All I got is a shack"             
Me.Image2.ToolTip = "It's hard on these streets"             
Me.Image3.ToolTip = "The car is broke down too"         
End If

I know this isn't the way even I want to do it. I want the points totals to actually be from the user ID. Also it seems there has to be a better construct to do this.

Below is what I have so far for just showing the current users ID but it errors and fails hard.


VB.NET:
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" EmptyDataText="There are no data records to display.">
<Columns>                
<asp:BoundField DataField="points" HeaderText="points" SortExpression="points" />             
</Columns>         
</asp:GridView>         
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ConnectionStrings:ASPNETDBConnectionString1%>" ProviderName="<%$ConnectionStrings:ASPNETDBConnectionString1.ProviderName %>" SelectCommand="SELECT DISTINCT [points] FROM [ProfilePropertyValues] WHERE ([UserId] = @UserId)">             <SelectParameters>
<asp:ProfileParameter Name="UserId" PropertyName="UserId" Type="Object" />
</SelectParameters>
</asp:SqlDataSource>

Current root level web.config


VB.NET:
<?xml version="1.0"?>
  <configuration>   
<connectionStrings>     
<add  name="ApplicationServices" connectionString="data  source=.\SQLEXPRESS;Integrated  Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User  Instance=true" providerName="System.Data.SqlClient"/>     
<add  name="ASPNETDBConnectionString1" connectionString="Data  Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ASPNETDB.MDF;Integrated  Security=True;User Instance=True"  providerName="System.Data.SqlClient"/>   
</connectionStrings>   
<system.web>     
<compilation debug="true" strict="false" explicit="true" targetFramework="4.0">       
<assemblies>          
<add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>         
<add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>         
<add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>       
</assemblies>     
</compilation>     
<authentication mode="Forms">       
<forms loginUrl="~/Account/Login.aspx" timeout="2880" />     
</authentication>     
<membership>      
<providers>        
 <clear/>         
<add  name="AspNetSqlMembershipProvider"  type="System.Web.Security.SqlMembershipProvider"  connectionStringName="ApplicationServices"  enablePasswordRetrieval="false" enablePasswordReset="true"  requiresQuestionAndAnswer="false" requiresUniqueEmail="false"  maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6"  minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10"  applicationName="/"/>
       </providers>     
</membership>     
<profile enabled="true" inherits="" automaticSaveEnabled="true" defaultProvider="AspNetSqlProfileProvider" > 
      <providers>      
   <clear/>      
   <add name="AspNetSqlProfileProvider"  type="System.Web.Profile.SqlProfileProvider"  connectionStringName="ApplicationServices" applicationName="/"/> 
      </providers>     
</profile>     
<roleManager enabled="true">      
 <providers>        
 <clear />         
<add connectionStringName="ApplicationServices" applicationName="/" name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider"  />  
       <add applicationName="/"  name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" />   
    </providers> 
    </roleManager>
   </system.web> 
  <system.webServer>
     <modules runAllManagedModulesForAllRequests="true"/> 
  </system.webServer> 
  <system.net>   
  <mailSettings>
       <smtp from="afds">   
      <network host="localhost" password="" userName="" />
       </smtp>    
 </mailSettings>
   </system.net> 
</configuration>

I'm pretty sure most of my sites functionality can be pretty well finished with stock asp.net objects. If there is any other code that would help set the scene for you to reply just let me know. As I've said I'm spending about 10+ hours a day on this and researching about it and I'm sure I'll see the request fairly quickly. Thanks so much for the read and please help me kind sirs! Also I will be updating the original post with solutions and source so if nothing else perhaps another starting developer can benefit from my lengthy frustration.
 
Last edited:
Updating your posted code with a few carriage returns will help us all see what you've done and if we can help.
 
Ok, done. Hopefully that is a bit easier to follow. The main thing that I'm working on now is just making the system aware of the current user. I got some feedback on that specifically and was pointed towards Validating User Credentials Against the Membership User Store (VB): The Official Microsoft ASP.NET Site . Stating that after all of the authentication is done then use the membership.GetUser to find the specific attributes that I want to touch. I don't know however if this is exactly what I need. The specific action I'm looking for is to pull down a users "points" and manipulate it throughout a specific page "~/LifeUser/GamePage.aspx" then put back the value of "points" back into the db after the change occurs.
 
Back
Top