Uncategorized

Creating A Customizable Personal Blog In ASP.NET

Introduction and Background I don’t want to say too much in this article, just to demonstrate the presentation I have to give today. This article is a short “long story” that can be considered as an answer to the most common question “How to create a blog in ASP.NET?“. Well, what I find most compelling is that most people don’t know what a blog per se is, because if they did, they could just play around with ASP.NET to create one for themselves in a night or two. In this article, I am going to discuss some steps that need to be followed when creating your own blog. I’m not a good designer so please forgive the most annoying design you will see in the coming paragraphs. But I promise I’ll give you an overview of a blog in ASP.NET. The facts I am going to talk about, or why you should read this article, is that this article is not a “specific” guide to my own procedures. Instead, I’m writing this article to give you a quick overview of what a blog is, what ASP.NET has in store for you, how you can create it, and not only that, but how you can blog with all that you have. In most cases, you only have a small area to host with less disk space and no database. I will also cover what to do in such cases. Just read the post. To add some content, I wrote a Windows 10 client application to consume the blog posts via the ASP.NET Web API. I’m sure this web API thing for ASP.NET blog posts would interest you in most cases.What is a blog anyway? To keep the content simple here, a blog is a Place to share whatever you want, whenever you want, with whoever you want! This is a common type of blogs that are used. Blog is short for weblog (logging, makes sense?). There are more specific types of blogs depending on your content. Some blog categories are as follows:

  1. Microblogs Compact and simple blogs. 140 character beast, Twitter is an example of this type.
  2. Personal blogs Anyone can create them and they are very personal and only demonstrate one person. Your website can be your personal blog.
  3. Media blogs You can share images, videos, and other multimedia content in media blogs.

A blog So basically it’s just a content sharing site. If you’ve ever created an online website for sharing content, up-to-date work information, and regular diary, then you’ve already worked on developing a personal blog. Blog is just a term for an online log system where you can “log” your regular topics of discussion. So, in this article, I’m going to cover a basic application that can act as a blog for someone. As an additional support, I will also give you an idea of ​​how to use ASP.NET’s Web API to promote your blog in native applications, e.g. Getting started with ASP.NET Since most readers aren’t currently upgrading to ASP.NET MVC 6 themselves, I’ll use ASP.NET MVC 5 (not ASP.NET 5) to show you how it goes do it Things are very similar in ASP.NET MVC 5 and ASP.NET MVC 6. The common things that will change in the coming versions is that ASP.NET is now cross-platform, so if you keep writing the same application by following my article in ASP.NET MVC 6, you can host it on a server in Ubuntu or run Mac etc. But that’s no big deal here, is it? I’m going to use ASP.NET MVC 5 (not ASP.NET 5!) to demonstrate how to create your own personal ASP.NET blog. But before I launch Visual Studio, I wanted to explain the term “customizable” used in the title of my current article. By customizable, I mean

Reading: How to create a blog using asp net mvc

  1. a blog that is completely flexible. You can integrate plugins or update the theme and so on.
  2. A blog that doesn’t rely on any specific third-party framework, not even a data source.
  3. A blog that builds directly on top of ASP.NET assemblies and requires nothing from you at all.
  4. A general purpose blogging platform that can then be modified to
    1. create a social blogging service.
    2. Personal CV House
    3. Your own website to demonstrate your services
    4. So on and so on.

See also: How to Develop an Android App from Scratch

In short, the blog can be customized to suit your own needs and requirements. After all, an ASP.NET blog is just an ASP.NET web application that you’ve customized to suit your own needs. At this point I would like to ask you to create a new ASP.NET project on your own machine, in the next section I will move on to the next things like creating controllers, defining views and so on. So it would be good for you to create a new project at this moment and move on to the next article.Creating the ApplicationFirst, let me share with you how I actually created the ASP.NET web application to host my blog. I will use a web interface and an API interface to be able to consume the blog from multiple native applications. So in this section I will talk about ASP.NET programming and then Windows 10 application programming to actually leverage the blog posts and show them to users in a “native experience“. >Web Interface ControllerFirst of all, I will consider creating the web interface to be able to present the blog to the web using a browser. This is what ASP.NET was originally developed for. Creating websites and web applications. Web applications were introduced a little later and then the web API was introduced and so on. So I’m going to use the very basic concepts of ASP.NET MVC to create a simple web application that can “act” as a blog the question (in the title) will be asked by a beginner in ASP.NET. NET, so if you are ignorant of ASP.NET, please read the previous posts of mine which cover ASP.NET in great detail and would help you in understanding and learning every bit of ASP.NET programming as can be seen from the A beginner’s perspective.

  1. Understanding ASP.NET MVC with real-world examples, for beginners and intermediate users.
  2. MVC newbie? Read this (ASP.NET MVC is an implementation of the MVC pattern of software development, this post talks about MVC, not ASP.NET MVC).

I will continue to share more of my articles and posts as the topic progresses. I would recommend that you read the above posts if you are new to ASP.NET, most of the concepts like controllers, views and models can confuse you if you are a newbie!Almost done I am a big fan of JSON data, I prefer using JSON over SQL databases, so I’m a fan of the Newtonsoft.Json library. So please remember to install the library before proceeding. This library would be the backbone for our datasource.PMFor this page I would show the HTML code instead, and for the rest of the pages I show the images because I want to show how to use the actions. The page uses the conditional values ​​from the controller. You may have noticed the value of Controller that is passed as a model (of type BlogPostModel). I checked this to see if there are any posts in the data source. This is pretty simple and straight forward. The main thing is to see what happens when there is a new post in the data source. Please see the next section!Create a postWhen you create a new post, follow the hyperlink that takes you to a page where you created a form, etc. I’m not the designer type , so the UI is very ugly. You can improve it if you want. The view for “C” in “CRUD” looks something like this. Very simple, yet powerful! The power is in your hands. Add some or leave it if you don’t want to share the admin panel with anyone. 🙂 Once this page loads, it will take the following form of the web page.Figure 1: Create a new blog post page. Filling formThe HTML above takes this form. The HTML looks clean thanks to hard work by:

  1. ASP.NET team for providing a template.
  2. Bootstrap folks, this is where Twitter Bootstrap is used (will be shared with provided with the ASP.NET template ).
See also  Create a drop-down list

You can now submit the contribution. Okay, so far things are pretty neat and simple. Do you have any questions? Please read this section again. Check Default Page NowIf you now go back to the default page, you will see that the blog would now post the posts (currently only 1). The following is the image, you already have the HTML for this page. Figure 2: Default page with a blog in the listNow the page can show that we have a post, it shows the tags and name. nothing else. After all, why should we display anything else on the default page?Reading the blog posts, one at a timeIf you could read the HTML for the default page, you will see that the title of the blog post is Post is actually a URL to the blog post to read. I created the action for it (please see the controller code for the Read action). With that we could now read the content,Figure 3: Reading the post shows the date, time, content and tags. This is how I display the content. I agree, a very bad design. But I’m very bad at designing web applications. (I know my first try failed because the IDs were null and Ah, you got it the second time, didn’t you? Stop whining!). I used the following HTML code for this, the thing was I just wanted to display the blog post in a very simple way. In fact, in your case, you will write something much more useful. But for now just read this.

So this code would give us the mail. I hardcoded a lot of things like “Posted byIt was pretty simple, but I also wanted to demonstrate the concept. Add new posts Another thing is to add new posts. This is the same, only requires one view. I’ll give you an overview of adding new posts, multiple posts, and previewing them on the default page in a moment.Figure 6: Creating a new blog post, secondThis is similar, just a little understanding is how it is rendered in the blog.Figure 7: Two posts are previewed What I wanted to share here is that ASP.NET does not automatically sort the posts, you would have to do that yourself. If you pay attention to the LINQ code, you will understand it. This would now sort the blogs in descending order. Because of this, “Two posts” appears at the top, while it would come after “First blog post!” in the JSON data. But we’ve now sorted the list based on our needs.Transition to Windows 10 Application and Web APIBefore I actually transition, I would like to make one final post that would be read in the application! Please see the following image, then we will proceed to the next section.Figure 8: Last post onlineThe web interface has been sufficiently discussed, the next sections are about the web API and the windows 10 application programming.Further reading:If you want to learn more, please read the following documents and articles.

  1. A tip for Ajax developers in the ASP.NET MVC framework
  2. Getting started with LINQ in C#
See also  How To Create Your Own Website For A School Project - The Website Architect

See also: How to Start a WordPress Blog on Bluehost (2023 Review)

Web API and Windows 10 Client ApplicationIn this section, I will first talk about the ASP.NET Web API and then create the application to use the API and view the blogs. In the client application we don’t need any functionality like create, update etc. We only consume and display the data so the client application doesn’t have enough functionality but would display the content. Building the APIActually, the API is simple and nothing needs to be done! The application has already completed, so our API would just redirect to the application and load and return the data from the model. The API doesn’t need to have HTML data or CSS stylesheets, instead the API simply returns the data in JSON or XML format. I personally recommend and will always recommend using JSON. XML is a very heavy format and also not efficient. JSON is a very simple, lightweight and portable format! The API is just a controller with the same actions we need and a return type. Since we don’t need any functions other than C (from CRUD), I defined the API as simply as:

Small but sufficient. This would allow us to use the API from our client application. There is also no need to edit the API configuration since I provided the routing scheme to the function. This would automatically redirect to this URL. The rest of the functionality is to be provided by the application. Note that this function reads the data back from the model and returns it as a collection. These would then later be translated as JSON data. So our application can use the JSON converters to get the data from the API and render it in the application. I hope things are clear for the API by this stage! If not, please read again. I think the contribution is pretty simple.Creating the client application; Windows 10 ApplicationGreat, so far you have learned how to create an online blog which has web interface and API interface. I will continue to the next post to teach you how to use the API. The post went much further than I expected (it exceeded 4,000 words). Read the article above and leave your feedback, I’d love to hear it! Interesting Points Thank you for reading the post. I have presented you with a general but simple and easy way to create your own blog. The post provides the information you may need to start your own personal online blog. I haven’t shared a third party library because I want you to be able to add your own. The blog is based on native ASP.NET frameworks. In a later post I will also present the common concepts for creating the data sources so that the only dependency on Newtonsoft.Json is removed from this project as well. Until then, please bear with me. One more thing, the text editor used is a plain text area, you can replace it with your favorite WYSIWYG editor to harness the power of HTML, and then render the HTML on screen. I’ll be adding two more in the next few days Write posts:

  1. Consuming the Web API from Windows 10 application.
  2. Building your own custom data sources.

Stay tuned for more content like this !

See also: How to Use WordPress to Make a Website [Guide for Beginners]

.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button