How to Enable Windows Authentication in Katana

Katana is Microsoft’s own implementation of OWIN, the Open Web Interface for .NET. There are several layers of OWIN:
Host – where it manages the processes in which the OWIN pipeline runs.
Server – opens a network socket and listens for requests.
Middleware – processes HTTP request and response.

Katana provides 2 servers, both of these supports Windows Integrated Authentication.
Microsoft.Owin.Host.SystemWeb
Microsoft.Owin.Host.HttpListener

This article will show you how you can enable Windows Authentication in Katana. You can use IIS to host Katana or use HttpListener to self-host Katana in a custom process.

Read the rest of the post here:  http://www.asp.net/aspnet/overview/owin-and-katana/enabling-windows-authentication-in-katana

Share and Enjoy

  • Facebook
  • Twitter
  • Delicious
  • LinkedIn
  • StumbleUpon
  • Add to favorites
  • Email
  • RSS

Enable Tracing in ASP.NET

To understand what the application is doing, we need to trace what it does from step one down to its last step. Tracing is a technique that allows us to monitor what the application is doing to find defects in the application and have a clear diagnostic data of it. Tracing in ASP.NET will let us view the data of every request made in an ASP.NET page.

Debugging is different from tracing, when an application is monitored in a development phase, we call it debugging. But if it is monitored in a production environment, we call it tracing.

Read the rest of the article here: http://a1ashiish-csharp.blogspot.com/2013/08/c-sharp-asp-.net-how-to-enable-tracing-in-asp.net-using-c-sharp.net.html

Share and Enjoy

  • Facebook
  • Twitter
  • Delicious
  • LinkedIn
  • StumbleUpon
  • Add to favorites
  • Email
  • RSS

AJAX Helper in ASP.NET MVC

AJAX-driven applications are very common nowadays which means more and more probabilities exist to deal with forms properly. For instance, you can use libraries like JQuery to make AJAX calls to ASP.NET but there is a better way to enable AJAX to your forms – using AJAX helper.

AJAX helper provides AJAX functionality to your web applications. There are two core features of AJAX helper:

1. Submit an entire form using AJAX.
2. Invoke action method.

AJAX helper allows you to configure aspects of the AJAX requests like a success calback and a failer callback. There are available in properties of AJAXOptions class.

Read the rest of the post here:  http://www.codeguru.com/csharp/.net/working-with-ajax-helper-in-asp.net-mvc.htm

Share and Enjoy

  • Facebook
  • Twitter
  • Delicious
  • LinkedIn
  • StumbleUpon
  • Add to favorites
  • Email
  • RSS

How to Send Email from Gmail using C#

If your host fails to send emails all of a sudden and you need to send one quick, there are different ways to send an emal using your gmal account. However, this very simple task can do the best method in sending a mail. This article will teach you how to send email from your gmail using C#. We will use the SendEmail method which accepts the recipients email id, the subject and the body of the email. You’ll also need gmail settings to make it work.

Read the rest of the post here: http://a1ashiish-csharp.blogspot.com/2013/03/Csharp.Net-How-To-Send-email-from-gmail-using-c-sharp.html

Share and Enjoy

  • Facebook
  • Twitter
  • Delicious
  • LinkedIn
  • StumbleUpon
  • Add to favorites
  • Email
  • RSS

Inject Controller Libraries Dynamically at Runtime

With WebAPI’s custom assembly resolver feature you can add Controller libraries at runtime dynamically. Consider it when you need a system that can dynamically spin up the CRUD operation based on the entity at Run time. Users  can create an invoice template using Invoice Designer UI that they can add/remove fields to the invoice whenever desired. Once done, they can save it in the system and the  UI will be generated along with the fields created. This is a good scenario for Code Generation of the service in Invoice design. If there are no changes, the previous designer will continue to work.

Read the rest of the post here: http://www.dotnetcurry.com/ShowArticle.aspx?ID=898

Share and Enjoy

  • Facebook
  • Twitter
  • Delicious
  • LinkedIn
  • StumbleUpon
  • Add to favorites
  • Email
  • RSS

Server Side Paging using ASP.NET GridView Control

When you hear about GridView control, the first thing that comes out of your mind is the default paging that comes with GridVew control. It’s great for demos and small databases but if you want to use it in a bigger site, you might need other options. This is because the default GridView control will have a massive performance drop in large databases.

GridView paging retrieves all the record frm SQL then displays it only when required. Thus you’ll see a massive performance drop if you use it in large sites. The best way to handle it is to use GridView control with ObjectDataSource control and specify the methods for manual paging.

Read the rest of the tutorial here: http://www.dotnetcurry.com/ShowArticle.aspx?ID=267

Share and Enjoy

  • Facebook
  • Twitter
  • Delicious
  • LinkedIn
  • StumbleUpon
  • Add to favorites
  • Email
  • RSS

How to Use Custom Action Names in ASP.NET Web API

WebAPI action methods use the same HTTP method name that they are serving by default. If you deal with HTTP GET method, the Web API has the Get() action method. However, you need to customize these action method names so it is more readable to you and to the other coders.

You can customize action method names in different ways.

By creating a sample Web API.
Creating action methods by prefixing with HTTP method.
Use attributes to specify HTTP method and action method mapping.
Using the [ActionName] attribute

and many others.

Read the rest of the post here: http://www.codeguru.com/csharp/.net/using-custom-action-names-in-asp.net-web-api.htm

Share and Enjoy

  • Facebook
  • Twitter
  • Delicious
  • LinkedIn
  • StumbleUpon
  • Add to favorites
  • Email
  • RSS

Testing and Consuming OData Services with Fiddler, SharePoint, LinqPad, and Excel

If you want to test and consume oData services, there are plenty of ways to do that. But the best methods are using Fiddler, LinqPad, Excel, and SharePointServer 2013.

OData or Open Data Protocol is a web protoco for performing CRUD operations built on web technologies like HTTP, Atom Publishing, and JSON to provide access to different applications like stores and services.

This article will demonstrate how to consume and test OData services using tools like Fiddler, Excel, LinqPad, and SharePoint Server 2013.

Read the rest of the post here: http://www.dotnetcurry.com/ShowArticle.aspx?ID=882

Share and Enjoy

  • Facebook
  • Twitter
  • Delicious
  • LinkedIn
  • StumbleUpon
  • Add to favorites
  • Email
  • RSS

How to Create HTML5 Chart Helper Extension in ASP.NET MVC 4

In ASP.NET the traditional control model GUI is no longer used. It was replaced with a web 2.0 style JavaScript and JQuery plugin model. However, adding incremental features to existing HTML components is always required. This is why Microsoft introduced HTMLHelper and Helper extensions. Helper extension are .NET extensions that return as string typically formatted in HTML.

This article will create an extension that renders a bar chart on HTML5 Canvas. IT is bound to data source or assigned to data source from the client side.

Read the rest of the post here: http://www.dotnetcurry.com/ShowArticle.aspx?ID=822

 

Share and Enjoy

  • Facebook
  • Twitter
  • Delicious
  • LinkedIn
  • StumbleUpon
  • Add to favorites
  • Email
  • RSS

How to Send Email with Attachment in ASP.NET

Sending an email with attachment with ASP.NET is easy. The file that will be sent as an attachment in ASP.NET will be uploaded using FileUpload and will be added dynamically as an attachment in the MailMessage object without saving any file in the disk.

Here is the code to send an email with attachment using Gmail SMTP:

For C#:

protected void SendEmail(object sender, EventArgs e)
{
    using (MailMessage mm = new MailMessage(txtEmail.Text, txtTo.Text))
    {
        mm.Subject = txtSubject.Text;
        mm.Body = txtBody.Text;
        if (fuAttachment.HasFile)
        {
            string FileName = Path.GetFileName(fuAttachment.PostedFile.FileName);
            mm.Attachments.Add(new Attachment(fuAttachment.PostedFile.InputStream, FileName));
        }
        mm.IsBodyHtml = false;
        SmtpClient smtp = new SmtpClient();
        smtp.Host = “smtp.gmail.com”;
        smtp.EnableSsl = true;
        NetworkCredential NetworkCred = new NetworkCredential(txtEmail.Text, txtPassword.Text);
        smtp.UseDefaultCredentials = true;
        smtp.Credentials = NetworkCred;
        smtp.Port = 587;
        smtp.Send(mm);
        ClientScript.RegisterStartupScript(GetType(), “alert”, “alert(‘Email sent.’);”,true);
    }
}

Share and Enjoy

  • Facebook
  • Twitter
  • Delicious
  • LinkedIn
  • StumbleUpon
  • Add to favorites
  • Email
  • RSS