Tag - Website

Understanding and Creating Sitemaps for Your Website
Mar 14, 2024

Introduction:  A sitemap is a crucial element in optimizing your website for search engines. It serves as a roadmap, guiding search engine crawlers through the various pages and content on your site. In this blog post, we'll delve into what sitemaps are, how they are used, and provide step-by-step guidance on creating one. Additionally, we'll explore an alternative method using online sitemap generators.  What is a Sitemap?  A sitemap is essentially a file that provides information about the structure and content of your website to search engines. It lists URLs and includes additional metadata such as the last modification date, change frequency, and priority of each page. The primary purpose is to help search engine bots crawl and index your site more efficiently.  How is a Sitemap Used?  1. Improved Crawling:     Search engines use sitemaps to discover and understand the organization of your website. This aids in more efficient crawling, ensuring that no important pages are missed.  2. Enhanced Indexing:    By providing metadata like the last modification date and change frequency, sitemaps help search engines prioritize and index pages based on their relevance and importance.  3. SEO Benefits:    Having a well-structured sitemap can positively impact your site's search engine optimization (SEO), potentially leading to better visibility in search results.  How to Create a Sitemap:  1. Understand Your Website Structure:  Before creating a sitemap, familiarize yourself with your site's structure, including main pages, categories, and any dynamic content.  2. Choose a Sitemap Generation Method:  Manual Method: Use a text editor to create an XML file, including URLs, last modification dates, etc.  CMS Plugin: If you use a content management system (CMS) like WordPress, leverage plugins such as Yoast SEO or Google XML Sitemaps.  Online Sitemap Generator: Use online tools like XML-sitemaps.com or Screaming Frog to automatically generate a sitemap.  3. Include Relevant Information:  For each URL, include the `<loc>` (URL), `<lastmod>` (last modification date), `<changefreq>` (change frequency), and `<priority>` (priority) tags.  4. Save and Upload:  Save the XML file with a ".xml" extension (e.g., "sitemap.xml"). Upload it to your website's root directory using FTP or your hosting provider's file manager.  5. Submit to Search Engines:  Submit your sitemap to search engines using their webmaster tools (e.g., Google Search Console, Bing Webmaster Tools).  Alternative Method: Using Online Sitemap Generator:  1. Choose a Tool:  Select an online sitemap generator such as XML-sitemaps.com or Screaming Frog.  2. Enter Your Website URL:  Input your website's URL into the generator.     3. Generate and Download:     Click the "Generate" or "Crawl" button to initiate the process.  Once complete, download the generated sitemap file.     4. Upload and Submit:  Upload the downloaded file to your website's root directory and submit it to search engines.    Conclusion:  Creating and submitting a sitemap is a fundamental step in optimizing your website for search engines. Whether you opt for manual creation or use online generators, a well-structured sitemap can significantly contribute to better search engine visibility and improved SEO. Regularly update and submit your sitemap to ensure that search engines stay informed about changes to your site's content. 

How to Configure AWS Cognito for Login Flow
Jan 31, 2024

  To set up the AWS Cognito for the registration/login flow, follow these steps: First Flow: User Registration in Cognito1. Install the following NuGet packages in your .NET project:   <PackageReference Include="Amazon.AspNetCore.Identity.Cognito" Version="3.0.1" /> <PackageReference Include="Amazon.Extensions.Configuration.SystemsManager" Version="5.0.0" /> <PackageReference Include="AWSSDK.SecretsManager" Version="3.7.101.27" /> Declare AWS configuration values in appsettings: "Region": "me-south-1", "UserPoolClientId": "UserPoolClientId", "UserPoolClientSecret": "UserPoolClientSecret", "UserPoolId": "me-south-pool"   Additional Configuration Add authentication in program/startup files to enable sign-in with Cognito. 2. Create a CognitoUserPool with a unique ID in the controller: private readonly CognitoUserPool _pool; private readonly CognitoUserManager<CognitoUser> _userManager; var user = _pool.GetUser(registerUserRequest.LoginId); 3.Add user attributes (email, phone number, custom attributes) using user.Attributes.Add().   user.Attributes.Add(CognitoAttribute.Email.AttributeName, registerUserRequest.Email); user.Attributes.Add(CognitoAttribute.PhoneNumber.AttributeName, registerUserRequest.Mobile); user.Attributes.Add("custom:branch_code", registerUserRequest.BranchCode); user.Attributes.Add("custom:preferred_mode", preferedMode); 4. Create the user: cognitoResponse = await _userManager.CreateAsync(user, registerUserRequest.Password); Check cognitoResponse.Succeeded to determine if the user was created successfully.   Second Flow: User Login with Cognito 1.Search for the user in Cognito using the login ID: var cognitoUser = await _userManager.FindByIdAsync(loginUserRequest.LoginId);   2.Set a password for the Cognito model: var authRequest = new InitiateSrpAuthRequest {    Password = loginUserRequest.Password };   3.Use StartWithSrpAuthAsync to get the session ID: var authResponse = await cognitoUser.StartWithSrpAuthAsync(authRequest);   4.Add MFA method and validate using MFA auth if needed. For MFA validation, set the MFA settings in Cognito:v ar authRequest = new RespondToMfaRequest {        SessionID = validateLoginUserRequest.SessionId,        MfaCode = validateLoginUserRequest.Otp,        ChallengeNameType = ChallengeNameType.SMS_MFA }; authResponse = await cognitoUser.RespondToMfaAuthAsync(authRequest);   Extract tokens from Cognito: authResponse.AuthenticationResult.IdToken authResponse.AuthenticationResult.RefreshToken   Forgot Password Flow 1.Search for the user with LoginId in Cognito and call ForgotPasswordAsync: var user = await _userManager.FindByIdAsync(loginUserRequest.LoginId); await user.ForgotPasswordAsync();   2.Optionally, call ConfirmForgotPassword method in Cognito. _userManager.ConfirmForgotPassword(userID, token, newPassword, CancellationToken cancellationToken) Here, understanding AWS Cognito Authentication Methods and Utilizing Them as Needed.  

Hosting a .NET Application on IIS Server
Jan 29, 2024

Hosting your .NET application on an IIS (Internet Information Services) server allows it to be accessed and consumed over the internet by users. IIS is commonly used to host .NET applications and web APIs.  Before you can host the application, ensure you have the following:  A .NET web application or API built (for example using ASP.NET Core)  A Windows Server machine with IIS installed and configured  Permissions to remotely access the server over a network    Follow this step-by-step guide to deploy your .NET Application on the IIS Server seamlessly.  Step 1: Open your .NET Application in Visual Studio  Open your application or project in Visual Studio and build the application.    Step 2 : Publish the Application or project.  Now, Right-click on your project and select the publish option.  Here, select the folder and then click on next, and finish the publish setup.  Now, Click on the publish button to publish your code to one folder.  After, publishing is succeeded click on the open folder. You will see your published code in this folder.    Step 3: Configure IIS on the Server  Carry out these steps to prepare IIS for hosting the application. If IIS is not installed in your system, then first install the IIS on your machine.  Open IIS Manager on the Windows Server  Right-click on the Sites folder and click Add Website                    3. Provide a name for the website, Set the physical path to the app folder, and select a port where you want to host the application.                    4. Click OK to create the new IIS website.   Step 4: Publish code to IIS Server.  Now stop the website and open the folder that you have given in the Physical path while configuring it, by right-clicking on your website and selecting explore.  Now, copy all the published files into your server folder.  Once all the files are copied into the publish folder Start the website and click on Browse*: {Your port} (http) under browse website.  you will see the output of your code on the server.  If your project is based on MVC then Recycle Application pool is required. You can find your Application pool under the Application Pool section. Right-click on your website app pool and click on recycle. Conclusion: Hosting the application on IIS allows it to be reached by users from over the network and the internet. It handles request routing and security layers for serving the application.

Enhancing Performance Monitoring with Application Insights in Azure
Jan 24, 2024

Are you grappling with performance issues in your project? Look no further—Application Insights is here to help! In this blog post, I'll guide you through the process of configuring and implementing Application Insights to supercharge your application's performance monitoring. Step 1: Installing the Application Insights Package The first crucial step is to integrate the Application Insights package into your project. Simply add the following PackageReference to your project file: <PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.22.0" /> And Register service in Program.cs or Startup.cs : builder.Services.AddApplicationInsightsTelemetry(); builder.Services.ConfigureTelemetryModule<DependencyTrackingTelemetryModule>((module, o) => { module.EnableSqlCommandTextInstrumentation = true; }); Add connection string in appsettings.json :  "ApplicationInsights": {   "InstrumentationKey": "" } This sets the stage for a seamless integration of Application Insights into your application. Step 2: Unleashing the Power of Application Insights Now that the package is part of your project, let's dive into the benefits it brings to the table:  1. Identify Performance Bottlenecks Application Insights allows you to track the execution time of individual stored procedures, queries, and API calls. This invaluable information helps you pinpoint areas that require optimization, paving the way for improved performance.  2. Monitor Database Interactions Efficiently analyze the database calls made by specific APIs within your application. With this visibility, you can optimize and fine-tune database interactions for enhanced performance.  3. Comprehensive Error and Exception Tracking Application Insights goes beyond performance monitoring by providing detailed information about errors, traces, and exceptions. This level of insight is instrumental in effective troubleshooting, allowing you to identify and resolve issues swiftly.  Step 3: Integration with Azure for Data Collection and Analysis To maximize the benefits of Application Insights, consider integrating it with Azure for comprehensive data collection and analysis. This step amplifies your ability to make informed decisions regarding performance optimization and problem resolution. In conclusion, Application Insights equips you with the tools needed to elevate your application's performance. By identifying bottlenecks, monitoring database interactions, and offering comprehensive error tracking, it becomes a cornerstone for effective troubleshooting and optimization. Stay tuned for more tips and insights on how to harness the full potential of Application Insights for a high-performing application!

Mastering API Security: A Guide to Conditional Authorization and Swagger Customization
Jan 02, 2024

In this blog, I will be sharing insights on how to effectively manage Conditional Authorization and Swagger Customization.   Case 1   I'm currently working on a problem our QA team found while testing our website. Specifically, there's an issue with one of the features in the application that uses an API. In the QA environment, we need to allow access without authentication, but in the production environment, authentication is required. To fix this, I added a feature called Conditional Authorize Attribute with help of Environment Variable. This feature lets us control access to the API based on the environment. It allows anonymous access when necessary.   In my situation, I've added a environment variable setting called "ASPNETCORE_ENVIRONMENT" to "QA" in the testing site's pipeline. Because of this, I can use the API on the QA server without requiring authentication.   This method also helps specific authorization rules for the API based on the environment.   Case 2 Additionally, I've added Swagger requests into a value object to meet specific requirements on swagger. By extending the Swashbuckle Swagger IOperationFilter, I integrated logic tailored to our needs. This approach allows us to customize requests in Swagger for all APIs directly.   Furthermore, I've implemented a middleware designed to handle responses and here's how it works. In my case, there are three kinds of response class in my code that specify the response type (like ApiErrorResponse, ValidatorResponse, ResponseModel). According to the requirements, when we get a 200-status code with the correct response class model, I need to wrap the response object in a value format. I created a middleware for this. It figures out which endpoint we're dealing with through the HttpContext. Using that endpoint, I grab the metadata related to the ProducesResponseTypeAttribute class and check for a status code of OK (Metadata Extraction). If I manage to get the metadata with a status code of 200, I include that response in value format. Otherwise, I stick with the same model response. This helps you to modify the response as per needed outcome. These implementations provide a flexible solution for conditionally authorizing API access and wrapping request/response in an object according to specified requirements.

Kafka with ELK implementation
Aug 17, 2020

Apache Kafka is the numerous common buffer solution deployed together with the ELK Stack. Kafka is deployed within the logs delivery and the indexing units, acting as a segregation unit for the data being collected: In this blog, we’ll see how to deploy all the components required to set up a resilient logs pipeline with Apache Kafka and ELK Stack: Filebeat – collects logs and forwards them to a Kafka topic. Kafka – brokers the data flow and queues it. Logstash – aggregates the data from the Kafka topic, processes it and ships to Elasticsearch. Elasticsearch – indexes the data. Kibana – for analyzing the data.   My environment: To perform the steps below, I set up a single Ubuntu 18.04 VM machine on AWS EC2 using local storage. In real-life scenarios, you will probably have all these components running on separate machines. I started the instance in the public subnet of a VPC and then set up a security group to enable access from anywhere using SSH and TCP 5601 (for Kibana). Using Apache Access Logs for the pipeline, you can use VPC Flow Logs, ALB Access logs etc. We will start by installing the main component in the stack — Elasticsearch. Login to your Ubuntu system using sudo privileges. For the remote Ubuntu server using ssh to access it. Windows users can use putty or Powershell to log in to Ubuntu system. Elasticsearch requires Java to run on any system. Make sure your system has Java installed by running the following command. This command will show you the current Java version. sudo apt install openjdk-11-jdk-headless Check the installation is successful or not by the below command ~$ java — versionopenjdk 11.0.3 2019–04–16OpenJDK Runtime Environment (build 11.0.3+7-Ubuntu-1ubuntu218.04.1)OpenJDK 64-Bit Server VM (build 11.0.3+7-Ubuntu-1ubuntu218.04.1, mixed mode, sharing) Finally, I added a new elastic IP address and associated it with the running instance. The example logs used for the tutorial are Apache access logs.   Step 1: Installing Elasticsearch We will start by installing the main component in the stack — Elasticsearch. Since version 7.x, Elasticsearch is bundled with Java so we can jump right ahead with adding Elastic’s signing key: Download and install the public signing key: wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add - Now you may need to install the apt-transport-https package on Debian before proceeding: sudo apt-get install apt-transport-https echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-7.x.list Our next step is to add the repository definition to our system: echo “deb https://artifacts.elastic.co/packages/7.x/apt stable main” | sudo tee -a /etc/apt/sources.list.d/elastic-7.x.list You can install the Elasticsearch Debian package with: sudo apt-get update && sudo apt-get install elasticsearch Before we bootstrap Elasticsearch, we need to apply some basic configurations using the Elasticsearch configuration file at: /etc/elasticsearch/elasticsearch.yml: sudo su nano /etc/elasticsearch/elasticsearch.yml Since we are installing Elasticsearch on AWS, we will bind Elasticsearch to the localhost. Also, we need to define the private IP of our EC2 instance as a master-eligible node: network.host: "localhost" http.port:9200 cluster.initial_master_nodes: ["<InstancePrivateIP"] Save the file and run Elasticsearch with: sudo service elasticsearch start To confirm that everything is working as expected, point curl to: http://localhost:9200, and you should see something like the following output (give Elasticsearch a minute or two before you start to worry about not seeing any response): {   "name" : "elasticsearch",   "cluster_name" : "elasticsearch",   "cluster_uuid" : "W_Ky1DL3QL2vgu3sdafyag",   "version" : {     "number" : "7.2.0",     "build_flavor" : "default",     "build_type" : "deb",     "build_hash" : "508c38a",     "build_date" : "2019-06-20T15:54:18.811730Z",     "build_snapshot" : false,     "lucene_version" : "8.0.0",     "minimum_wire_compatibility_version" : "6.8.0",     "minimum_index_compatibility_version" : "6.0.0-beta1"   },   "tagline" : "You Know, for Search" }   Step 2: Installing Logstash Next up, the “L” in ELK — Logstash. Logstash and installing it is easy. Just type the following command. sudo apt-get install logstash -y Next, we will configure a Logstash pipeline that pulls our logs from a Kafka topic, processes these logs and ships them on to Elasticsearch for indexing. Verify Java is installed: java -version openjdk version "1.8.0_191" OpenJDK Runtime Environment (build 1.8.0_191-8u191-b12-2ubuntu0.16.04.1-b12) OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode) Let’s create a new config file: Since we already defined the repository in the system, all we have to do to install Logstash is run: sudo nano /etc/logstash/conf.d/apache.conf Next, we will configure a Logstash pipeline that pulls our logs from a Kafka topic, processes these logs, and ships them on to Elasticsearch for indexing. Let’s create a new config file: input {   kafka {     bootstrap_servers => "localhost:9092"     topics => "apache"     } } filter {     grok {       match => { "message" => "%{COMBINEDAPACHELOG}" }     }     date {     match => [ "timestamp" , "dd/MMM/yyyy:HH:mm:ss Z" ]     }   geoip {       source => "clientip"     } } output {   elasticsearch {     hosts => ["localhost:9200"]   } } As you can see — we’re using the Logstash Kafka input plugin to define the Kafka host and the topic we want Logstash to pull from. We’re applying some filtering to the logs and we’re shipping the data to our local Elasticsearch instance.   Step 3: Installing Kibana Let’s move on to the next component in the ELK Stack — Kibana. As before, we will use a simple apt command to install Kibana: sudo apt-get install kibana We will then open up the Kibana configuration file at: /etc/kibana/kibana.yml, and make sure we have the correct configurations defined: server.port: 5601 server.host: "<INSTANCE_PRIVATE_IP>" elasticsearch.hosts: ["http://<INSTANCE_PRIVATE_IP>:9200"] Then enable and start the Kibana service: sudo systemctl enable kibana sudo systemctl start kibana We would need to install Firebeat. Use: sudo apt install filebeat   Open up Kibana in your browser with http://<PUBLIC_IP>:5601. You will be presented with the Kibana home page.

Benefits of having a website for your business
Sep 04, 2019

It’s simple, if you have a business you must need a website to succeed online. If you do not have a website your business doesn’t exist. In this digital era, people are engaged on the internet to find information, product, and services. In simple words to say your website is made for your customers to find you online and get noted by them for your offerings/services. Here mentioned are few benefits of making a website for your business. Online Advertisement A website can be a greater tool for advertising. With the help of the best SEO service provider, your website will be ranked on top search results to increase website traffic and generate more sales and profits. Gaining more customers Print media, Radio Ads, Television Ads can be very expensive channels in the advertisement as compared to Websites. You can choose an affordable SEO agency to improve your website performance to help you gain more customers to your city, state, worldwide. 24x7x365 days Accessible Make sure your website is accessible all the time, hence it is convenient for your customers to visit any time to you. People can find complete information about your products and services in which you deal. Keeping a strong presence online will help you increase customer base, with the help of the website you are noted all over the world. Large Opportunity Through the website, you can build trust, which in turn helps to earn the large no. of opportunities through your website. Large no. of opportunities can tend to large no. of conversion. The above mentioned are not the only benefits of having a website. On the basis of the type of business requisites, it differs from case to case.