Tuesday, September 20, 2011

Features of .net framework 4.5

The .Net framework 4.5 has lots of new features and improvements in existing sections like:

.NET for Metro style apps
-The .NET APIs for Metro style apps provide a set of managed types that you can use to create Metro style apps for Windows using C# or Visual Basic.

Core New Features and Improvements
-features and improvements added to the common language runtime and to .NET Framework classes
-Managed Extensibility Framework (MEF)
-Asynchronous File Operations

Web
- New in ASP.NET 4.5

Networking
-Improved internationalization and IPv6 support.

-RFC-compliant URI support.
See also

-Support for Internationalized Domain Name (IDN) parsing.
What is Internationalize Domain Name?

-Support for Email Address Internationalization (EAI).

See also

-Windows Presentation Foundation (WPF)


-Windows Communication Foundation (WCF)
See Also

-Windows Workflow Foundation (WF)

Compiled By: Rajesh Rolen

Read More

.NET Framework 4.5: Windows Communication Foundation 4.5

Simplification of generated configuration files.

Support for contract-first development.

Ability to configure ASP.NET compatibility mode more easily.

Changes in default transport property values to reduce the likelihood that you will have to set them.

Updates to the XmlDictionaryReaderQuotas class to reduce the likelihood that you will have to manually configure quotas for XML dictionary readers.

Validation of WCF configuration files by Visual Studio as part of the build process, so you can detect configuration errors before you run your application.

New asynchronous streaming support.

New HTTPS protocol mapping to make it easier to expose an endpoint over HTTPS with Internet Information Services (IIS).

Ability to generate metadata in a single WSDL document by appending ?singleWSDL to the service URL.

Websockets support to enable true bidirectional communication over ports 80 and 443 with performance characteristics similar to the TCP transport.

Support for configuring services in code.

XML Editor tooltips.

ChannelFactory caching support.

Binary encoder compression support.
Read More

.NET Framework 4.5:Windows Presentation Foundation (WPF)

The new Ribbon control, which enables you to implement a ribbon user interface that hosts a Quick Access Toolbar, Application Menu, and tabs.

The new INotifyDataErrorInfo interface, which supports synchronous and asynchronous data validation.

New features for the VirtualizingPanel and Dispatcher classes.

Improved performance when displaying large sets of grouped data, and by accessing collections on non-UI threads.

Data binding to static properties, data binding to custom types that implement the ICustomTypeProvider interface, and retrieval of data binding information from a binding expression.

Repositioning of data as the values change (live shaping).

Better integration between WPF and Win32 user interface components.

Ability to check whether the data context for an item container is disconnected.

Ability to set the amount of time that should elapse between property changes and data source updates.

Improved support for implementing weak event patterns. Also, events can now accept markup extensions.
Read More

New features in ASP.NET 4.5

Support for new HTML5 form types.

Support for model binders in Web Forms. These let you bind data controls directly to data-access methods, and automatically convert user input to and from .NET Framework data types.

Support for unobtrusive JavaScript in client-side validation scripts.

Improved handling of client script through bundling and minification for improved page performance.

Integrated encoding routines from the AntiXSS library (previously an external library) to protect from cross-site scripting attacks.

Support for WebSockets protocol.

Support for reading and writing HTTP requests and responses asynchronously.

Support for asynchronous modules and handlers.

Support for content distribution network (CDN) fallback in the ScriptManager control.

Read More
Read More

.NET Framework 4.5: Asynchronous File Operations

New asynchronous features were added to the C# and Visual Basic languages. These features add a task-based model for performing asynchronous operations. To use this new model, use the asynchronous methods in the I/O classes.
Example of Asynchronous File Operation
Read More

Managed Extensibility Framework (MEF)

The Managed Extensibility Framework (MEF) provides the following new features:

Support for generic types.

Convention-based programming model that enables you to create parts based on naming conventions rather than attributes.

Multiple scopes.
Read More

.NET Framework 4.5: Features and improvements added to the common language runtime and to .NET Framework classes

Ability to limit how long the regular expression engine will attempt to resolve a regular expression before it times out.

Ability to define the culture for an application domain.

Console support for Unicode (UTF-16) encoding.

Support for versioning of cultural string ordering and comparison data.

Better performance when retrieving resources.

Zip compression improvements to reduce the size of a compressed file.

Ability to customize a reflection context to override default reflection behavior through the CustomReflectionContext class.
Read More

What are Metro style apps

Metro style apps are full screen apps tailored to your users' needs, tailored to the device they run on, tailored for touch interaction, and tailored to the Windows user interface. Windows helps you interact with your users, and your users interact with your app.
ReadMore
Read More

Saturday, September 10, 2011

How to Protect email address from spam bots/harvesters

What is spam?

Spam is flooding the Internet with many copies of the same message, in an attempt to force the message on people who would not otherwise choose to receive it. Most spam is commercial advertising, often for dubious products, get-rich-quick schemes, or quasi-legal services. Spam costs the sender very little to send -- most of the costs are paid for by the recipient or the carriers rather than by the sender.

Email spam:

Email spam, also known as junk email or unsolicited bulk email (UBE), is a subset of spam that involves nearly identical messages sent to numerous recipients by email. Definitions of spam usually include the aspects that email is unsolicited and sent in bulk.

E-mail address harvesting:

E-mail harvesting is the process of obtaining lists of e-mail addresses using various methods for use in bulk e-mail or other purposes usually grouped as spam.

There are lots of tricks available which can be used to protect email address from spam bots like:

Using CSS Trick:Using a css, you can completely hide your email address from spam harvesters. The drawback to this approach is that it will only work on sites that read left-to-right as it uses CSS to reverse the direction of text.
span.reverse {
  unicode-bidi: bidi-override;
  direction: rtl;
}
At the point that you are ready to present the email address, code it in your HTML, but just key it in backwards. For example:
moc.liamg@hsejaR
The CSS above will then override the reading direction and present the text to the user in the correct order.

This will work but not for long, cause the pattern still gives the spammer crawlers hints that it's absolutely a reversed email.



HTML Escape Characters: Using javascript we can encrypt the email
function XOR_Crypt(EmailAddress)
{
    Result = new String();
    for (var i = 0; i < EmailAddress.length; i++)
    {
     Result += String.fromCharCode(EmailAddress.charCodeAt(i) ^ 128);
    }
    document.write(Result);
}
Using reCAPTHA: Using reCAPTHA its very easy and better approach then using javascript encryption or using CSS reverse strategy. http://www.google.com/recaptcha/mailhide/
Writing email address like: Contact me
Enkoder: Enkoder is also an option. http://hivelogic.com/enkoder/
Contact Page: its always better, instead of showing email address to contract you, you should provide an form where user can enter his details and send you email.
My Opinion: In my opinion don't bother about spam bots. Normally in our inbox we gets several thousand spams every day. Our spam filter let maybe 1 or 2 a day through. As spam filters are really good, why make it difficult for legitimate people to contact you. So Just don't worry be happy :)

Compiled By: Rajesh Rolen

Read More

Wednesday, September 7, 2011

ASP.NET Interview Questions Page-7

Read More

ASP.NET Interview Questions Page-6

Read More

ASP.NET Interview Questions Page-5

Read More

ASP.NET Interview Questions Page-4

Read More

ASP.NET Interview Questions Page-3

Read More

ASP.NET Interview Questions Page-2

Read More

ASP.NET Interview Questions

Read More

Sunday, September 4, 2011

Constants in .NET


There are two types of constants available in c#:
Compile-time constants and runtime constants. They have different behaviors and
using wrong one will cost you performance or correctness.


But Runtime constants are always preferable over
compile-time constants. Though the compile-time constants are slightly faster
but they are not flexible with compare to runtime constants.


The compile-time constants are preferable when performance
is really required and you don’t have any requirements to change the value of
that constant.


Compile-time constant are declared using “const” keyword:


Eg: public const int a=10;


Run-time constants are declared using “readonly” keyword:


Eg: public readonly int a=10;



compile-time – “Const”


run-time – “readonly”


compile-time
constant
can be declared at class level


Run-time
constant
can be declared at class level


compile-time
constant
can be declared at method level


Run-time
constant
Cannot be declared at method level


A compile-time constant is replaced with the value of that
constant in object code.

Eg:

public const int a=10;

int b=20;

if(b==a)

compiles to the same IL as if you had written this:

if(b==10)// means instead of comparing with variable ‘a’ it
will write its value in compiler-generated IL. Which increase speed but for
various situations its not preferable.


Runtime constants are evaluated at runtime. The IL generated
when you reference a read-only constant references the “
readonly “
variable,
not the value.

Eg:

public const int a=10;

int b=20;

if(b==a)

compiles to the same IL as if you had written this:

if(b==a)// so instead of placing its value as like it do with
“const”,  its place variable for “readonly” variables in compiler-generated
IL.


compile-time constant cannot initialize using the new operator,
even when the type being initialized is a value type.


runtime constants can be of any type, They

must
be initialized using constructor, or using initializer.


Compile-time constants can be used only for primitive types
(built-in integral and floating-point types), enums, or strings.

 

These are the only types that enable you to assign meaningful
constant values in initializers.

 

As we know that for “const” type in compiler-generated IL the
variables get replaces with vales so,these primitive types are the only ones
that can be replaced with literal values. in the compiler-generated IL.


runtime
constants can be of any type.

Read-only values are also constants, in that they cannot be
modified after the constructor

has executed. But read-only values are different in that they
are assigned at runtime.


Compile-time
constants are much more better in performance but less flexible with compare
to run-time constants.


Run-time constants are much more flexible but its performance
is slower with compare to compile-time constants.


Compile-time constants are, by definition,

static
constants.


readonly values can be used for instance constants,
storing different values

for each instance of a class type.


Every
time application assembly need to be rebuilt whenever library assembly which
contains constant gets its constant value changed ( as the compiler-generated
IL contains values of compile-time constants instead of referring variable)


No need to rebuild Application assembly which is referring a
library assembly which contains run-time constants whose value is changed and
its assembly is rebuilt.


 


The final advantage of using const over readonly is
performance: Known constant values can generate slightly more efficient code
than the variable accesses necessary for readonly values.
However, any gains are slight and should be weighed against the decreased
flexibility. Be sure to profile performance differences before giving up the
flexibility.



Compiled By: Rajesh Rolen

Read More
Powered By Blogger · Designed By Seo Blogger Templates