How to remove specific session in asp.net




You can set session element to null.

Example:-

Session["sessionname"] = null;

Posted in | 1 comments

How to parse html in C#?

First

You Can use Html Agility Pack
Details is availbale at 
http://html-agility-pack.net/?z=codeplex

This is an agile HTML parser that builds a read/write DOM and supports plain XPATH or XSLT (you actually don't HAVE to understand XPATH nor XSLT to use it, don't worry...). It is a .NET code library that allows you to parse "out of the web" HTML files. The parser is very tolerant with "real world" malformed HTML. The object model is very similar to what proposes System.Xml, but for HTML documents (or streams).

Second

using Fizzler that takes a jQuery/Sizzler approach to selecting HTML elements. It's based on HTML Agility Pack.Details available at below location.

https://code.google.com/archive/p/fizzler/

Posted in | 0 comments

Sending mail from my gmail account through .Net

Below is sample to send mail from your gmail account.

We will use System.Net.Mail to send mail from gmail account.

using System.Net;
using System.Net.Mail;
var fromAddress = new MailAddress("fromaddress@gmail.com", "Your Name");
var toAddress = new MailAddress("toaddress@example.com", "Receipt Name");
const string fromPassword = "YourPassword";
const string subject = "Subject";
const string body = "Body";
var smtp = new SmtpClient
{
    Host = "smtp.gmail.com",
    Port = 587,
    EnableSsl = true,
    DeliveryMethod = SmtpDeliveryMethod.Network,
    UseDefaultCredentials = false,
    Credentials = new NetworkCredential(fromAddress.Address, fromPassword)
};
using (var message = new MailMessage(fromAddress, toAddress)
{
    Subject = subject,
    Body = body
})
{
    smtp.Send(message);
}

Posted in | 0 comments

Difference between ScriptManager and ScriptManagerProxy in asp.net

You can only have one script manager per page but you can have multiple ScriptManagerProxy.

Used ScriptManagerProxy if you have the script manager in your master for instance which will go across all pages but you want a script manager reference in an underlying page or user control. 

In that instance you would add the proxy. If you added another script manager the page would error.

Posted in | 0 comments

Run First Application in Angular 2 (Angular 2 base project).


Run First Application in Angular 2 (Angular 2 base project).


è    Need to install node.js from below location.
(Install Latest version of node.js)

è    Run below command from node.js command prompt

npm install –g @angular/cli

ng new myapp

cd myapp

ng serve

Now you will see blow output.




Now run your application from localhost:4200  (mention in above command output). You may see different output base on version.



Posted in Labels: | 0 comments