EDUDOTNET

Tuesday, August 27, 2013

Dynamically Get/Add Web Page Title And Meta Tags Using C#

How To Get Web Page Title And Meta Tags By URL Using C#?
How To Add Dynamic Meta Tags Using C#?

We can get web page title and meta tags using c# by web url and also can add dynamic meta tags. We need to add "HtmlAgilityPack" for parse HTML document in c#.

Add Namespaces

using System.Text.RegularExpressions;
using System.Web.Script.Serialization;
using System.Web.UI.HtmlControls;
using HtmlAgilityPack;


Create Class And Function


Create Function For Getting Meta Tags

Add And Calling Functions

Get Results


Saturday, August 3, 2013

Exception: "Object reference not set to an instance of an object”

What do you mean by "Object reference not set to an instance of an object”?

Approximate every day, C# programmers getting this type of error and ask:
Why do I get the error "Object reference not set to an instance of an object"?
The program is trying to access a member of a reference type variable which is set to null that is a main reason getting type of exceptions.
In the Main method, notice that edudotnet is set to null. Therefore, the following code will throw a NullReferenceException:
Since edudotnet is null, it has no members to be accessed. Whereas the preceding example used a roperty call, the following example source code uses a method call:

The preceding code will throw a NullReferenceException; because, edudotnet is still null. It is irrelevant that the first example call was a property and the second was a method: they are both members of the type.  
To solve this edudotnet, be sure the edudotnet object is instantiated before being referenced.The following samplesource code instantiates edudotnet and, so, avoids the error message:Now, edudotnet contains a reference to an instance of EDUDOTNET; so, any of its members can be called.

Thursday, August 1, 2013

Get Element XPath of Selected Element Of IFrame Using Jquery

How To Get Element XPath of Selected Element Of IFrame Using Jquery

XPath

This a query language that can be used to select arbitrary parts of HTML documents in ability.
XPath is a language that describes a way to locate and process items in HTML And XML documents by using an addressing syntax based on a path through the document's logical structure or hierarchy.

Get  XPath of Selected Element Of IFrame Using Jquery

If you want to get element`s XPath of selected element of Iframe and also add highlight css in element on mouseover , out and click event.
     1.    Create Project
     2.  Add an Iframe page
a.       -Add required contents & element
b.      Add reference of “Highlight” css file under the page head.
     3.  Add Iframe parent page
a.       Add Iframe
b.  Add required content and element.
c.  Add jquery-1.4.1.js or latest js file under head section    
d.      Create Jquery code and function for this functionality.
e.      Add document.ready function.
f.        Create function get element`s XPath.


Highlight CSS (highlight.css)



IFrame Page(Iframe.htm)

Main Page (Parent Page-Index)
Jquery Code 
Sample Screenshots
- Highlight-on-mouseover

-Get XPath On Click In Alert()