2
Answers

Creating web site like blog

Ask a question
Nermin Huskic

Nermin Huskic

11y
1.3k
1
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

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.


Answers (2)