Skip to content

Creating web site like blog

Nermin Huskic

Asked Aug 19, 2013, 2:05 PM EDT2 answers
Share
LinkedInX
So far i saw 2 ways of making website, on wich users can add articles. Like here on charp corner. One way is using this fuction
C#
protected
void Button1_Click(object
sender, EventArgs e)
    {
        if
(Page.User.Identity.IsAuthenticated==true)
        {
            try
            {
                File.Copy(Server.MapPath("") + "\\Submit.aspx",
(Server.MapPath("") + "\\" + TextBox.Text + ".aspx"));
                File.Copy(Server.MapPath("") + "\\Submit.aspx.cs",
(Server.MapPath("") + "\\" + TexzBox.Text + ".aspx.cs"));
                Response.Redirect(Naslov.Text +
".aspx");
            }
            catch
            {
                Response.Write("<script>window.alert('Change your subject name!')</script>");
            }
        }

With this you copy one form content to antoher. So i can use empty web form, with labels with no text, and add text from Submit.aspx page to it. 

Another way is by posting article in database, and using on Article.aspx?uid=123 example that 123 is Id of article in database to show that article.
I want to am i doing it wrong on this way? Is there any other way with wich i can implemet this? I want to hear your ideas. Many of you are doing this for a long time.

2 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • Mahesh Chand
    0
    Are you trying to build a Blog website? It depends on what your requirements are. You can store everything in a database to manage them in a better way.
    0
  • 0
    I have made it, on that way. So i have everything in database. I call articles in a page called Article.aspx?uid=123 like, and 123 respresents Article id. So on page Article you can read all articles by id. Is that good way of implementing.
    0