我有电子商务网站。列出所有产品的页面(使用ListView控件)。我为一个产品详细信息创建了一个页面(原始名称为DynamicPage),但是当它加载时,它将其在url中的名称替换为产品名称。直到这里一切都很好,但这里的URL就像这样
http://localhost:57265/OTTALINE%20Water%20Resistant%20Bluetooth%20Speakers.aspx
我想要这样
http://localhost:57265/OTTALINE-Water-Resistant-Bluetooth-Speakers
任何人都可以帮助我吗?
DynamicPage加载功能
Private Sub PopulatePage()
Dim pageName As String = Me.Page.RouteData.Values("product_name").ToString()
Dim query As String = "SELECT * FROM products WHERE product_name = @PageName"
Dim conString As String = ConfigurationManager.ConnectionStrings("conio").ConnectionString
Using con As New MySqlConnection(conString)
Using cmd As New MySqlCommand(query)
Using sda As New MySqlDataAdapter()
cmd.Parameters.AddWithValue("@PageName", pageName)
cmd.Connection = con
sda.SelectCommand = cmd
Using dt As New DataTable()
sda.Fill(dt)
If dt.Rows.Count > 0 Then
productName.Text = dt.Rows(0)("product_name").ToString()
sku.Text = dt.Rows(0)("sku").ToString()
shortIntro.Text = dt.Rows(0)("short_brief").ToString()
stock.Text = dt.Rows(0)("stock_status").ToString()
moq.Text = dt.Rows(0)("moq").ToString()
shipDays.Text = dt.Rows(0)("delivery_time").ToString()
End If
End Using
End Using
End Using
End Using
End Sub