Lets Have a fun with Technology.

BTemplates.com

Follow by Email

Tuesday, December 25, 2012

Friday, December 21, 2012

How to secure webservice in asp.net.


Hello Frd's

While working with web service in asp.net one main question that stick on my mind is how I make secure  my web service.

I am going to publish web service in public domain any one can use it after knowing web url. I found very good discussion from asp.net forum let me share with you.


Securing a web service can be achieved at many levels, it is up to you to which level you may want to do.

1) Customised Token Based:

Have a web method where user may provide his credentials. Credentials could be username and password; this is quite similar to login page of the web form application. So, once user passes his username and password system validates these credentials against the database system generates a unique token (which is generally guid) and saves this against userid ion the database. This token is returned to the user as well. So, now onwards whenever user acceses other web methods (of functional nature) this token will need to be passes along as parameter. Before actually processing the call system validates this token against the database. If it is validated user is allowed to process the web method call. Additionally, just like session in the web forms application, you may control the timeout as well. for e.g. the token may remain valid for some pre-defined time and post that whenever user tries to access any method token gets expired and user is denied the request. You may set this timeout during login web method call.

2) WSE 3.0 Authentication:  

Web Services Enhancements (WSE) is a webservice standard which provides cross-platform security for webservices. Following URL will provide a step-by-step detail on how to use WSE 3.0 for authenticating webservices with your custom user database.

http://aleemkhan.wordpress.com/2007/09/18/using-wse-30-for-web-service-authentication/

Following link describes in detail how to develop and apply authentication, authorization, and secure communication techniques to secure ASP.NET Web services and Web service messages. It describes security from the Web service perspective and shows you how to authenticate and authorize callers and how to flow security context through a Web service. It also explains, from a client-side perspective, how to call Web services with credentials and certificates to support server-side authentication.


http://msdn.microsoft.com/en-us/library/aa302390.aspx#secnetch10_authstrategies

Pass Argument when opening page from Link button/Hyperlink from gridview.



Hello,

use below code to pass argument to new opening page.

Suppose we are try to open EmpDetail page by cliking on HyperLink.

<asp:HyperLink ID="mylink" runat="server"
         NavigateUrl='<%# Eval("EmpID","EmpDetail.aspx?EmpId={0}") %>' Text='<%# Eval("EmpName") %>'>
</asp:HyperLink>


Enjoy !!!!

Thursday, December 6, 2012

How to Create Add-In Setup for Visual Studio.


Hello,

Create Setup for Add-In is similar step which we are following to create windows application setup. only one thing that we keep in mind is files location of setup files.

Follow below step to make Add-in Setup.

1. Create "Visual studio installer" Project.



2. Create "custome folder" from File system window.



    In Above main point remember to change default location. Change it to "[PersonalFolder]\Visual Studio 2010\Addins"

3. Add .dll,.Addin  and .xml file in to windows installer.



Now build and Run installer.

Enjoy !!!!

Let me know if you face any problem. if you able to build setup then just comment on below.







Why to use partial class or Interface or Struct in C# ?



Partial Class , Interface and Struct was introduced in C#.net 2.0 framework.

Lets see why to use this Partial Class or Interface or struct.

First main point it they  allow more than one developers to work simultaneously on the same class, struct or interface.
   
Second is Partial class are particularly helpful for customizing auto generated code by the IDE. Whenever the IDE generate the code then tool may define some partial class, interface, methods and further customization of partial class, interface is done by the developers without messing with the system generated code.


Now lets see main key points for using partial class or Interface or Struct in C# .



  •       During code compilation, all the parts should be available to form the final class, interface or           struct.
  •       Any member declared in the one part will be available to all other parts.
  •       If any part has Inheritance, then it applies to the entire class.
  •       Different parts of a class or struct may inherit from different interfaces.
  •       If any part is declared abstract, then the whole class, interface or struct is considered abstract.
  •       If any part is declared sealed, then the whole whole class, interface or struct is considered sealed.


Partial Class, Interface or Struct Example

Partial Class :-
 
class NameSpace
{
 partial class MyPartialClass
 {
 void PartialClass() {  }
 }
 partial class MyPartialClass
 {
 void PartialClass2() {  }
 }
}

Interface  :-

partial interface InterfaceExample
{
 void InterfaceTest();
}
 partial interface InterfaceExample
{
 void InterfaceTest2();
}

Struct  :-

partial struct StructExample
{
 void StructTest()
{
 }
}
 partial struct StructExample
{
void StructTest2()
{

}
}



Wednesday, December 5, 2012

Popular Add-ins/plugin For Microsoft Visual Studio.






PowerCommands is a Microsoft-created plugin that offers a variety of new features that one would think probably should have been in Visual Studio in the first place.
These include
  • Copying/Pasting project references!
  • "Open Containing Folder" to jump straight to the hard-drive location of a file or project
  • Automatic reorganizig and sorting of using statements
  • "Open Command Prompt Here" to open a command prompt in any of your project folders.
  • Collapse Projects

  • Manage Reference Paths
  • Prevent accidental Drag & Drop in Solution Explorer
  • Prevent accidental linked file delete
  • Apply Fix (automatically fix build errors/warnings)
  • Open PowerShell
  • Show Assembly Details
  • Create Code Contract
  • Cancel Build when first project fails
  • Debug Output - custom formatting
  • Build Output - custom formatting
  • Search Output - custom formatting
  • Configure WPF Rendering
  • Configure Fusion Logs
  • Configure IE for debugging
  • Locate Source File
  • Thumbnails in IDE Navigator
  • Extended support for xaml, aspx, css, js and html files
  • Disable Ctrl + Mouse Wheel Zoom
  • Zoom to Mouse Pointer
  • Configurability
  • Attach to local IIS
  • Copy Full Path
  • Build Startup Projects
  • Open Command Prompt
  • Search Online
  • Build Statistics
  • Group linked items
  • Copy/Paste Reference
  • Copy/Paste as Link
  • Collapse Solution
  • Group items directly from user interface (DependantUpon)
  • Open In Expression Blend
  • Locate in Solution
  • Edit Project File
  • Edit Solution File
  • Show All Files


RockScroll   - free.

Visual Assist X  Power through code with the robust yet
nearly invisible add-in for Visual Studio

SmartPaster - (FREE) Copy/Paste code generator for strings

AnkhSvn - (FREE) SVN Source Control Integration for VS.NET

VisualSVN Server - (FREE) Source Control

ReSharper – (Not Free)

ReSharper - IDE enhancement that helps with refactoring and productivity

CodeRush - Code gen macros on steroids

Refactor - Code refactoring aid

CodeSmith - Code Generator

GhostDoc - (FREE) Simple code commenting tool

DXCore (FREE) and its many awesome plugins: DxCore Community Plugins, CR_Documentor, CodeStyleEnforcer, RedGreen

TestDriven.Net - (FREE/PAY) Unit Testing Aid

Reflector - (PAY) Feature rich .Net Disassembler Reflector AddIn's

Web Deployment Projects - Provides additional functionality to build and deploy Web sites and Web applications (source).

StudioTools - (FREE) Navigation assistant, code metrics tool, incremental search, file explorer in visual studio and tear off editor windows
Resharper

Resharper MbUnit Test Runner Add-On

SQL Prompt for Database Projects (works inside your SQL Management Studio as well)

Ankh SVN 2.0+ for free SVN support (v1.x pales in comparison)

TeamCity plug-in to monitor your builds, personal builds, and bug tracking






Monday, December 3, 2012

Visual Studio Keyboard Shortcuts that are mostly use by Programmer.



Visual Studio Keyboard Shortcuts that are mostly use by Programmer.

Here are four keyboard short cuts for things you probably do often in Visual Studio.
  1. You want to add a blank line after the line you're on. You don't have to go to the end of the line and hit the <Enter> key. Just leave your cursor where it is and use Ctrl+Shift+Enter (Ctrl+Enter adds a line above).

  1. You want to uncomment a block of commented code. You don't have to select the whole commented block. Just put your cursor somewhere in the commented block and type the uncomment chord: Ctrl+K, U.

  1. You've got an error on line and see the little red bar that marks the SmartTag that provides the options for fixing the problem. You don't have to fiddle with the mouse to display the dropdown list of options. You can just type Ctrl+. (You don't even have to move your cursor back to the line in error).

  1. You type an object name, type a period, type the first letter of the member you want and get an IntelliSense list with lots and lots of entries. You don't have to type the whole name of the member you want. IntelliSense in Visual Studio 2010 recognizes camel-casing, so if you hold down the Shift key and type the capitalized letters in the member name you want, IntelliSense will give narrow the list down to that one.

 Source :-  visualstudiomagazine.com/

Saturday, December 1, 2012

List of all Ids for Icon for AddNamedCommand2 (Visual Studio Add-In).



List of all Ids for Icon for AddNamedCommand2 (Visual Studio Add-In).

Hello Frd's

Below is most of list of icon which used in Visual Studio Add-In Icon.

Command command = commands.AddNamedCommand2(_addInInstance,
"MyAddin1", "MyAddin1", "Executes the command for MyAddin1",
true, 59, ref contextGUIDS, (int)vsCommandStatus.
vsCommandStatusSupported+(int)vsCommandStatus.
vsCommandStatusEnabled, (int)vsCommandStyle.
vsCommandStylePictAndText, vsCommandControlType
.vsCommandControlTypeButton);

In this number six Argument is for Icon, You can take from below list.



































Friday, November 30, 2012

Visual Studio Warning : Missing XML comment for publicly visible type or member


Missing XML comment for publicly visible type or member 


You are getting this warning because your publicly visible types and members do not contains XML comment. You can disable this warning message by "Turn off the comment generation (in project properties)" but Best practice is to include comment in each publically visible types and members.


Add XML comments as shown below.

///<Summary>
/// gets the answer
///</Summary>
Public string Method()
{
   return "Now I am not getting, Missing XML comment for publicly visible    type or member ";
}



Why to include comments.
You are getting this error because your Visual studio editor set project to output documentation xml file (in the project settings). This is useful for class libraries (.dll assemblies) which mean users of your .dll are getting intelligence documentation for your API right there in visual studio.