Hi there, developing an online shop as a final project I need some help. I'll be happy if anyone could help me with it's programming in VB.NET.

Dani AI

Generated

started from a static HTML template. If you need server-side features (login, shopping cart, DB reads/writes) convert the template pages to .aspx so ASP.NET can run code-behind and server controls. You can keep layout HTML and call server endpoints, but for a VB.NET final project the simplest route is Web Forms: copy the template into Default.aspx, add a top-level <form runat="server">, and create Default.aspx.vb for Page_Load and event handlers. As suggested, specifics matter; below are concise, practical starting points you can drop into a Web Forms project.

A minimal, safe pattern for sign-in / sign-out (use parameterized queries and salted PBKDF2 hashes; built-in Membership is also an option):

' Login button click (VB.NET, Web Forms)
Protected Sub btnLogin_Click(sender As Object, e As EventArgs) Handles btnLogin.Click
    Dim username As String = txtUser.Text.Trim()
    Dim password As String = txtPass.Text

    Using cn As New SqlConnection(connString)
        Using cmd As New SqlCommand("SELECT PasswordHash, Salt FROM Users WHERE Username=@u", cn)
            cmd.Parameters.AddWithValue("@u", username)
            cn.Open()
            Using r = cmd.ExecuteReader()
                If r.Read() Then
                    Dim storedHash = r.GetString(0)
                    Dim storedSalt = Convert.FromBase64String(r.GetString(1))
                    Dim hash = ComputeHash(password, storedSalt)
                    If storedHash = hash Then
                        FormsAuthentication.SetAuthCookie(username, False)
                        Response.Redirect("~/Default.aspx")
                    Else
                        lblError.Text = "Invalid username or password"
                    End If
                Else
                    lblError.Text = "Invalid username or password"
                End If
            End Using
        End Using
    End Using
End Sub

Protected Sub SignOut()
    FormsAuthentication.SignOut()
    Session.Abandon()
    Response.Redirect("~/Default.aspx")
End Sub

Keep the shopping cart server-side (Session for quick use, DB for persistent carts). Example CartItem class and add-to-cart logic:

Public Class CartItem
    Public Property ProductId As Integer
    Public Property Name As String
    Public Property Price As Decimal
    Public Property Quantity As Integer
End Class

Protected Sub AddToCart(productId As Integer, qty As Integer, name As String, price As Decimal)
    Dim cart = TryCast(Session("Cart"), List(Of CartItem))
    If cart Is Nothing Then cart = New List(Of CartItem)()
    Dim existing As CartItem = Nothing
    For Each it As CartItem In cart
        If it.ProductId = productId Then existing = it : Exit For
    Next
    If existing IsNot Nothing Then existing.Quantity += qty Else cart.Add(New CartItem() With {.ProductId = productId, .Name = name, .Price = price, .Quantity = qty})
    Session("Cart") = cart
End Sub

Security & checkout checklist: use HTTPS, parameterized queries or an ORM, store passwords with PBKDF2/strong hashing, validate/encode all output to prevent XSS, protect against CSRF, never trust client prices (recompute server-side), wrap order+stock updates in DB transactions, and integrate a PCI-compliant payment gateway rather than storing card data. These steps cover the main gaps in the thread and give safe, practical building blocks for the sign-in/out and cart features.

Would be happy to help where I am able. Could you post a specific question, along with what code you have to this point, as it relates to your question?

Hi there, as I don't have enough time to focus on studying .net programming I need some help for my project. I don't have a clear vision of what shoud be done for an online shop. I'm starting it with a template, first of all I need to know in which type should the index page be saved. The template's index is .html itself, should I change it to .aspx or I don't need to.
I also need help with the sign in, sign out & shopping cart code.
Thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.