开发者

how to make html page by link name

I am building a page for produce name "product.aspx"

I have display some products in this page with hyperlink.

Now I want, when I click my product (such as pen) then it automatically makes an html page name pen.html with some information.

When I click clock then it automatically makes an html page name clock.html with some information.

How 开发者_StackOverflow社区can I do this?

I am using asp.net C# 3.5.


You can use a Literal to crete your html page in frontend ypu can add Literal

so in backend code you can create a html page by adding text to the literal

eg.

var productdata = datasource;

ltrProduct.text ="<head><title>"+productdata.title+"</title></head><body></body></html>";


Rather than actually creating a physical file for these products, its best to have a Web Form called something like "Product.aspx" which you pass a querystring to like:

/Product.aspx?product=Pen

This can then be URL Rewritten to something like:

/Product/Pen.aspx

You can then use this query string to return data like:

Dim cmd as new sqlcommand("SELECT Name, Price FROM Products WHERE FileName=@FileName", Conn)
cmd.CommandType = CommandType.StoredProcedure
cmd.parameters.AddWithValue("@FileName", Request.QueryString("product"))
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜