Sunday, April 27, 2025

Guess What I Found About React and SEO!

Hey everyone!

👋 I just found something super interesting that I had to share. 

 If you’re working with a React SPA (Single Page Application) like I am, you probably know that SEO can be a real headache. 🧠 Well, good news — I recently discovered how powerful Server-Side Rendering (SSR) can be for fixing that! 

 I even wrote a full blog about my experience of converting my React SPA into a proper SEO-friendly website using SSR. 🚀 

 If you’re curious or going through the same struggle, you can check it out here: 

In the post, I talk about the problems I faced, how I fixed them with SSR, and why it’s a total game-changer for SEO. Would love to hear what you think if you give it a read! 😊


Saturday, January 29, 2011

Pre-Loader in Asp.Net with javascript

Preloaders give the viewer something to look at while the Javascript, Css file downloads. Whenever we used javascript files and those file in depended each other or write code on HTML markup of javascript which called the function in those files sometime gives an error or sometime give some ugly shape of loading webpage. In this article I focused to create Pre-loader step by step.
Demo shows in asp.Net, in this demo we create two aspx pages, first page I use as a pre-loader and second page actual page we want to open.click here to download demo
Create a website and then add new aspx page with name of PreLoader.aspx, below code past in markup of it.
        var iLoopCounter = 1;
        var iMaxLoop = 6;
        var iIntervalId;
 
        function BeginPageLoad() {
            // Redirect the browser to another page while keeping focus.
            location.href = "<%=Request.QueryString[“Path”] %>";
            // Update progress meter every 1/2 second.
            iIntervalId = window.setInterval("iLoopCounter=UpdateProgressMeter(iLoopCounter,iMaxLoop);", 500);
        }

BeginPageLoad function called on body load event. Actual page Url pass by Query string. Window.setInterval function start calling UpdateProgressMeter function with initial parameters
<body onload="BeginPageLoad();" >
      function UpdateProgressMeter(iCurrentLoopCounter, iMaximumLoops) {
            var progressMeter = document.getElementById("ProgressMeter")
 
            iCurrentLoopCounter += 1;
            if (iCurrentLoopCounter <= iMaximumLoops) {
                progressMeter.innerHTML += ".";
                return iCurrentLoopCounter;
            }
            else {
                progressMeter.innerHTML = "";
                return 1;
            }
        }        
 
Above function shows the updated the progress of page loads.
            function EndPageLoad() {
            window.clearInterval(iIntervalId);
 
            // Find the object that represents the progress meter.
            var progressMeter = document.getElementById("ProgressMeter")
            progressMeter.innerHTML = "Page Loaded - Now Transferring";
        }

Above method call when page loaded completely. 
<body onload="BeginPageLoad();" onunload="EndPageLoad();">
You can test the pre-loader is working fine or not simple run application like as,
http://localhost/Preloader/PreLoader.aspx?Path=http://www.Choicepk.com



Summary,
We avoid loading page ugly still or old style and don’t want to display the page before loading all javascirpt and Css files. Pre-loader help us to achieve these tasks.
 

Saturday, January 1, 2011

C# 4.0 Dynamics vs. Reflection

Hi!

Ah ha, today I already wrote two more blog now I am moving on third one, I found new feature in C# 4.0 is Dynamics its to cool. its much faster than reflection mechanism also cached objects,
Simply I show demo given below,
First I create a Console Application then create a class name is myTestingClass

Snippet
public class myTestingClass

{
public string myProperty
{
get;
set;
}
}


Now I am going to call the above class by reflection and Dynamics.

Snippet
static void Main(string[] args)

{
Stopwatch mystopWatch = new Stopwatch();
long rang = 1000000;
var myTestType = new myTestingClass();
var property = typeof(myTestingClass).GetProperty("myProperty");
mystopWatch.Start();

for (int i = 0; i < rang; i++)
{
property.SetValue(myTestType, "Hello World", null);
}
mystopWatch.Stop();
Console.WriteLine(mystopWatch.Elapsed.TotalMilliseconds + " Milliseconds" + " First Time Result");

dynamic myTestDynamic = new myTestingClass();
mystopWatch.Reset();
mystopWatch.Start();
for (int i = 0; i < rang; i++)
{
myTestDynamic.myProperty = "Hello World";
}
mystopWatch.Stop();
Console.WriteLine(mystopWatch.Elapsed.TotalMilliseconds + " Milliseconds" + " First Time Result");
// Console.ReadLine();
mystopWatch.Reset();
mystopWatch.Start();

for (int i = 0; i < rang; i++)
{
property.SetValue(myTestType, "Hello World", null);
}
mystopWatch.Stop();
Console.WriteLine(mystopWatch.Elapsed.TotalMilliseconds + " Milliseconds" + " Second Time Result");

myTestDynamic = new myTestingClass();
mystopWatch.Reset();
mystopWatch.Start();
for (int i = 0; i < rang; i++)
{
myTestDynamic.myProperty = "Hello World";
}
mystopWatch.Stop();
Console.WriteLine(mystopWatch.Elapsed.TotalMilliseconds + " Milliseconds" + " Second Time Result");


Console.ReadLine();
}

Code result shown in below daigram,



above example shown results, first took then second time gave the result in litle time than the first time.

Send email to gmail account in ASP.Net

Hi guys,
I am very excited to share with you how to send email to gmail account in ASP.Net, I will try to explain all attribute,Methods and setting in details.

First of all we are going to configure gmail account setting in webconfig file,


Attribute

  • deliveryMethod: Specifies the delivery method for e-mails.
  • from: Specifies the from address for e-mails
  • configsource: I will explain in last paragraph of this article.
  • port: specifies the port of the server.
deliveryMethod:
  • specifiedPickupDirectory: Configures the local directory for a Simple Mail Transport Protocol (SMTP) server.
  • network: Configures the network options for an external SMTP server.

we must set Port "587" in webconfig and also set User Id and password of gmail account which you want to send email, Host name should be "smtp.gmail.com".

Second step you need to write code of server side in any events.


Snippetyou also need to declared System.Net.Mail namespace by using keyword.
I want to share one more interesting thing in Configuration section. you can create a separate file of Smpt.config ( you can use another name of .config file). you can plug that file in web.config file by
configsource attribute in smtp tag.