Senator Guerra Souty original series calendar,replica hublot blue steel peach pointer collocation of rolex replica Rome digital scale, track type minute replica watches scale shows that the classical model is swiss replica watches incomparable, wearing elegant dress highlights.
mr-ponna.com

 


ASP.NET articles and tutorials

Read ASP.NET articles

Sort by:

<< Start < Prev 1 Next > End >>
Page 1 of 1

ASP.NET articles and tutorials

# articles: 10  


Encrypt connectionStrings section of web.config

View(s): 5822

Encrypt connectionStrings section of web.config

Web.Config
<configuration>
    <connectionStrings>
        <add name="ConnString" connectionString="Data Source=.\SQLEXPRESS; 
AttachDbFilename=|DataDirectory|MyDatabase.mdf;Integrated Security=True;User Instance=True" />
    </connectionStrings>
</configuration>


The easiest way to encrypt the <connectionStrings> section is to use the aspnet_regiis command-line tool.
This tool is located in the following folder:

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\

Executing the following command encrypts the <connectionStrings> section of a Web.Config file
located in a folder with the path c:\Websites\MyWebsite:
   
    aspnet_regiis -pef connectionStrings "c:\Websites\MyWebsite"

The -pef option (Protect Encrypt Filepath) encrypts a particular configuration section located at a particular path.

You can decrypt a section with the -pdf option like this:

    aspnet_regiis -pdf connectionStrings "c:\Websites\MyWebsite"

ASP.NET page can read the value of the connection string by using the <%$ ConnectionStrings:ConnString %> expression

(Continued...) View Full Aritlce


  Last updated on Friday, 11 July 2014
  Author: Mr. Ponna
4/5 stars (3 vote(s))



Detecting Refresh or Post back in ASP.NET

View(s): 6676

Detecting Refresh or Post back in ASP.NET


The problem
There are situations where we would like to detect if the post back is from a form interaction (i.e. submit or button clicks) or is it by hitting the browser F5 refresh button. 

Many of them will jump saying how about checking 'Ispostback' value. 'IsPostback' will always have the value which was set previously. So for instance if the page was posted back before refresh, then the value will be true and if the page is not posted back before refresh, then the value will be false.

This article will first explain the fundamentals of how to solve the above problem and later this article will go in depth of how the source code looks like.

The fundamental

Description: 12.jpg

  • Step 1 :-We have created a javascript which will generate unique fresh GUID in submit button click. This GUID will be stored in the HttpContext object.
  • Step 2( User presses submit click ) :- If user presses submit button it will call the necessary javascript function to create the new fresh GUID again. 
  • Step 3 :-In 'HttpHandler' or 'HttpModule' the new GUID value is checked with the old GUID value. If the values are not equal then it means this was not called from a submit click and it's a refresh event. Accordingly the HttpContext session value is set.
  • Step 4 :-In the page load we can then check if this was a refresh or post back using the session variables.

3 important parts of the code

There are 3 important part of the code to be understood :-

  • Javascript which generates the unique
(Continued...) View Full Aritlce


  Last updated on Saturday, 21 June 2014
  Author: Mr. Ponna
4/5 stars (8 vote(s))



Send Email Using Gmail in ASP.NET

View(s): 8630

Send Email Using Gmail in ASP.NET

If you want to send email using your Gmail account or using Gmail's smtp server in ASP.NET application or if you don't have a working smtp server to send mails using your ASP.NET application or aspx page than sending e-mail using Gmail is best option.

you need to write code like this

First of all add below mentioned namespace in code behind of aspx page from which you want to send the mail.

using System.Net.Mail;

Now write this code in click event of button 

C# code

protected void Button1_Click(object sender, EventArgs e)
{
  MailMessage mail = new MailMessage();
  mail.To.Add("xyz@gmail.com");
  mail.To.Add("abc@yahoo.com");
  mail.From = new MailAddress("YourUserName@gmail.com");
  mail.Subject = "Email using Gmail";
  string Body = "Hi, this mail is to test sending mail"+
                "using Gmail in ASP.NET";
  mail.Body = Body;
  mail.IsBodyHtml = true;
  SmtpClient smtp = new SmtpClient();
  smtp.Host = "smtp.gmail.com"; //Or Your SMTP Server Address
  smtp.Credentials = new System.Net.NetworkCredential
       ("YourUserName@gmail.com","YourGmailPassword"); //Or your Smtp Email ID and Password
  smtp.EnableSsl = true;
  smtp.Send(mail);
}


VB.NET code 

Imports System.Net.Mail

Protected  Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs)

(Continued...) View Full Aritlce


  Last updated on Sunday, 01 June 2014
  Author: Mr. Ponna
3/5 stars (10 vote(s))



The C# Programming Language Version 4.0

View(s): 4695

The C# Programming Language Version 4.0

Visual Studio 2010 and the ..NET Framework 4.0 will soon be in beta and there are some excellent new features that we can all get excited about with this new release. Along with Visual Studio 2010 and the .NET Framework 4.0 we will see version 4.0 of the C# programming language. In this blog post I thought I'd look back over where we have been with the C# programming language and look to where Anders Hejlsberg and the C# team are taking us next.

In 1998 the C# project began with the goal of creating a simple, modern, object-oriented, and type-safe programming language for what has since become known as the ..NET platform. Microsoft launched the .NET platform and the C# programming language in the summer of 2000 and since then C# has become one of the most popular programming languages in use today.

With version 2.0 the language evolved to provide support for generics, anonymous methods, iterators, partial types, and nullable types.

When designing version 3.0 of the language the emphasis was to enable LINQ (Language Integrated Query) which required the addiiton of:

  • Implictly Typed Local Variables.
  • Extension Methods.
  • Lambda Expressions.
  • Object and Collection Initializers.
  • Annonymous types.
  • Implicitly Typed Arrays.
  • Query Expressions and Expression Trees.

If you're in need of learning about, or distilling knowledge of, any of these language features that I have mentioned

(Continued...) View Full Aritlce


  Last updated on Monday, 12 May 2014
  Author: Mr. Ponna
0/5 stars (0 vote(s))



What are Master Pages in .NET? Why we need Master Pages and how do we use Master Pages in our applications?

View(s): 13256


What are Master Pages in .NET? Why we need Master Pages and how do we use Master Pages in our applications?


Life before Master Pages

For a given website, there are multiple web pages with common layout. How we can achieve this?

  • Write the layout of the code in each page. But this leads to code redundancy which is not correct.
  • We can achieve the common layout, by using User controls.

Advantage of User Controls:

  • Turning an existing ASP.NET page into a user control requires only a few minor changes. User controls can be easily linked to any page that needs their services.
  • Furthermore, changes to a user control's implementation do not affect the referencing page and only require recompiling of the user control into an assembly.

Disadvantage of User Controls:

  • Any alteration to the control's public interface (such as the class name, properties, methods, or events) leads to the pages that reference the control must be updated.
  • Those pages must be re-compiled and needs deployment.
  • In addition, the next time a user views each page, the ASP.NET runtime will take a while to respond because the dynamic assembly for the page must be re-created.

Apart from the above two options, the other options is to use Master pages. A Master page is a file that contains the static layout of the file. It consists of the layout that is common throughout application (i.e. Application Level) or a folder level and dynamic parts will be customized by the pages that are derived from the Master page.

(Continued...) View Full Aritlce


  Last updated on Thursday, 13 March 2014
  Author: HariSantosh Kadiyala
3/5 stars (11 vote(s))



.NET Web Services and Security

View(s): 4549

.NET Web Services and Security

By Juval Lowy

When you use .NET to build a Web service, you rely on the built-in security support in ASP.NET and Internet Information Services (IIS). While this support makes developing secure ASP.NET Web Forms a breeze, it may require some work to develop and consume secure Web services. The problem is that ASP.NET and IIS security assumes there is a user on the other side of the wire, and that the user can type a user name and password into a dialog. Of course, with Web services there is no user involved, because Web services connect a client (an object) to a remote object (the Web service). This means that client-side developers have to provide your Web service with security credentials either explicitly or implicitly. .NET offers two security options to Web service developers: rely on Windows security or provide custom authentication. This article describes these two options and their different flavors and provides a side-by-side comparison of the security techniques.

Windows-Based Security

Using Windows-based security requires that the calling client application provide the credentials of an account on the server (or on the domain server). As a result, Windows security is most appropriate for intranet applications that use Web services to interact across a well-administered corporate network. This is because typically you have relatively fewer clients in an intranet application than in an Internet application. However, if managing a large number

(Continued...) View Full Aritlce


  Last updated on Monday, 23 December 2013
  Author: Mr. Ponna
3/5 stars (2 vote(s))



Beginner's Guide: How IIS Process ASP.NET Request

View(s): 2925

Beginner's Guide: How IIS Process ASP.NET Request

Introduction

When request come from client to the server a lot of operation is performed before sending response to the client. This is all about how IIS Process the request.  Here I am not going to describe the Page Life Cycle and there events, this article is all about the operation of IIS Level.  Before we start with the actual details, let’s start from the beginning so that each and every one understand it's details easily. 

What is Web Server ?

When we run our ASP.NET Web Application from visual studio IDE, VS Integrated ASP.NET Engine is responsible to execute all kind of asp.net requests and responses.  The process name is "WebDev.WebServer.Exe" which actually take care of all request and response of an web application which is running from Visual Studio IDE.

Now, the name “Web Server” come into picture when we want to host the application on a centralized location and wanted to access from many locations. Web server is responsible for handle all the requests that are coming from clients, process them and provide the responses.

http://www.dotnetfunda.com/UserFiles/ArticlesFiles/Abhijit%20Jana_634041500763171406_Firstone.JPG

What is IIS ?

IIS (Internet Information Server) is one of the most powerful web servers from Microsoft that is used to host your ASP.NET Web application. IIS has it's own ASP.NET Process Engine  to handle the ASP.NET request. So, when a request comes from client to server, IIS takes that request and  process it and send response back to clients

(Continued...) View Full Aritlce


  Last updated on Wednesday, 13 November 2013
  Author: Kishore Kumar
4/5 stars (8 vote(s))



ASP.NET Caching Basics

View(s): 3398

I will not bore you about "why caching is so great"; it is assumed you already understand, at least in theory, what caching can buy you as an ASP.NET developer.

At a minimum a developer wants to be able to cache some (or possibly all) of the pages in her ASP.NET Application. The simplest way to achieve this is to add the @ OutputCache directive to the top of the .aspx file of each page:

<%@ OutputCache Duration="5" VaryByParam="none" %>

Now, that was easy, wasn't it? But - exactly what does it do? You are specifying how long the page is to be retained in the Cache with the Duration attribute, in seconds. In the above example, this page will be rendered on the first request for it, and stored in Cache. For five seconds, all subsequent requests for this page will be served from the Cache, which is hugely faster than having to go through the entire Page lifecycle, possibly combined with database access, re-render and finally serve the page HTML to the client. After five seconds, the page will again be rendered (and once again, stored in the Cache).

The VaryByParam attribute is used to define parameters that determine which cached copy of a page should be sent to the browser. If your page doesn't change, you can set this to "none".

Caching Pages Based on QueryString items

If the contents of one of your pages can vary based on the value of certain items on the querystring, which is a common technique in ASP.NET, you can populate the VaryByParam attribute with a semicolon-delimited

(Continued...) View Full Aritlce


  Last updated on Friday, 04 October 2013
  Author: Mr. Ponna
5/5 stars (1 vote(s))



What is cookie less session? How it works?

View(s): 32643

When a user visits a Web site for the first time, the site creates a unique ID, known as a Session ID. The Session ID is unique for that current Session, making it possible for the server to keep track of the user's current Session information.

Generally this Session ID will be stored in cookie, for every request, browser will send this cookie back to server and will track the user session and restore correct user session back for that request.

What happens if cookies are not supported? ASP.NET server fails to track the session information. Then cookieless sessions are the best option. If you set the cookieless attribute of the sessionState element to "true" in your web.config, you will notice that sessions still work perfectly.

<sessionState cookieless="true" />

So, how it is tracking session information without cookies? Where is ASP.NET storing the session ID when cookies are not being used? In this case, the session ID is inserted in a particular position within the URL. Imagine you request a page like http://yourserver/folder/default.aspx, the slash immediately preceding the resource name is expanded to include parentheses with the session ID stuffed inside, as below.

http://yourserver/folder/(session ID here)/default.aspx

The session ID is embedded in the URL and there's no need to persist it anywhere.

Below are possible options to set cookieless session state.

  1. UseCookies - Cookies are always used, even if the browser or device doesn’t support cookies or
(Continued...) View Full Aritlce


  Last updated on Saturday, 14 September 2013
  Author: Mr. Ponna
3/5 stars (31 vote(s))



Overview ASP.NET Application Folders (About Special folders in ASP.NET)

View(s): 6617

Beginner's Guide to ASP.NET Application Folder

 

This Article Describe you about Special folders in ASP.NET like App_Code, App_Theme, App_Data, etc..

ASP.Net 2.0 uses file-based approach. It's means all class files, resource files, Data, Folder are maintain in a hierarchical way. If we are working with ASP.Net 2.0, we can add files and folder from "Add Items" Options. If we look at a sample application hierarchy, it will looks following figure.

Description: Description: Description: beginn1.jpg

we can add as many as files and folder (as per our requirements ) with our solutions.  And it's doesn't need to recompile them each and every time when they are added. Its Asp .NET’s overhead to dynamically compiled them when required. So, what ASP.Net 2.0 does, it contain a defined folder structure, contains files (Classes, Images, Resources etc..), compile them dynamically and even we can access those files throughout the application. ASP.Net Provides some special folder also to maintain files and resources. Let's see the advantages of using those folder .

Advantages of ASP.NET Application Folder 

Following are the main advantages of use of ASP.Net Application Folder

  • We can maintain resources (Classes, Images, Code, DatabasesThemes) in a organized way, which give us to developed and maintain sites easily.
  • All files and folder are accessible by through the application.
  • We can add as many files as possible as per our requirements.
  • Files
(Continued...) View Full Aritlce


  Last updated on Sunday, 25 August 2013
  Author: Mr. Ponna
4/5 stars (6 vote(s))

<< Start < Prev 1 Next > End >>
Page 1 of 1
Register Login Ask Us Write to Us Help