Skip to main content

Posts

Showing posts from March, 2011

Exception of WSHttpBinding with name WSHttpBinding failed validation?

"The WSHttpBinding with name WSHttpBinding failed validation because it contains a BindingElement with type System.ServiceModel.Channels.SymmetricSecurityBindingElement which is not supported in partial trust. Consider disabling the message security and reliable session options, using BasicHttpBinding, or hosting your application in a full-trust environment." In the web.config for the WcfService1 project, change the endpoint binding form the default wsHttpBinding to basicHttpBinding . Look under configuration/system.serviceModel/services/service and you will see the endpoint element Open the project properties page for the WcfService1 project. Set the "Secific port" property so an available port number. This will prevent issues later on. Under the "Web" section (look to the immediate left), change the "Specific Page" value to ClientBin/WpfBrowserApplication1.xbap Open the WcfService1 project properties page You need to perform

What is Abstraction ?

Code The major characteristics of oops are re usability and ease of usage. The ideas of oops include inheritance, abstraction, polymorphism, encapsulation, etc. According to Richard Gabriel, abstraction is "the process of identifying common patterns that have systematic variations; an abstraction represents the common pattern and provides a way to specify which variation to use." A parent class that permits inheritance but never allows for instantiation is known as an abstract class. One or more abstract methods from abstract classes don't have implementations. Inherited classes can specialize thanks to abstract classes. /// C# using System; namespace AbstractionSample { public abstract class Bank { private float _account; private float _amount; public float Account { get { return _account; } set { _account= value; } } public float Amount { get { return _amount; } set { _amount= value; } } public abstract void CalculateAccount(); public abstract void CalculateAmount(); }

how to insert data into 2 tables by using one sql query?

how to use a single SQL query to enter data into two tables? 1. If two tables do not have a relationship to one another. 2. If a relation exists Utilizing a stored process is one choice. BEGIN TRANSACTION DECLARE @DataID int INSERT INTO DataTable (Column1 ...) VALUES (....) SELECT @DataID = scope_identity() INSERT INTO LinkTable VALUES (@ObjectID, @DataID) COMMIT DECLARE @Object_Table TABLE (     Id INT NOT NULL PRIMARY KEY ) DECLARE @Link_Table TABLE (     ObjectId INT NOT NULL,     DataId INT NOT NULL ) DECLARE @Data_Table TABLE (     Id INT NOT NULL Identity(1,1),     Data VARCHAR(50) NOT NULL ) -- create two objects '1' and '2' INSERT INTO @Object_Table (Id) VALUES (1) INSERT INTO @Object_Table (Id) VALUES (2) -- create some data INSERT INTO @Data_Table (Data) VALUES ('Data One') INSERT INTO @Data_Table (Data) VALUES ('Data Two') -- link all data to first object INSERT INTO @Link_Table (ObjectId, DataId) SELECT Objects.Id, Data.Id FROM @Object_Tabl

What is SQL Injection? What is the best way to avoid it or is there something out there that I can follow?

If you're not careful, malicious users may be able to obtain data, change server settings, or even take over your server thanks to a general class of assaults known as SQL injection. SQL injection is an issue with poorly built apps rather than SQL Server. However, you're sure to encounter such an application at some point in your career, so you should be aware of the issue and its solution. When a user enters SQL code into a Web page as user input, the SQL code is subsequently run in the database, which is known as SQL injection (or a SQL injection attack). Make use of secure input and output handling techniques, such as: Input validation Escaping dangerous characters. Input encoding Output encoding Other coding practices which are not prone to code injection vulnerabilities, such as "parameterized SQL queries" (also known as "prepared statements" and sometimes "bind variables"). Modular shell disassociation from kernel The solutions mentioned her

What is Interoperability?

The.NET Framework makes it possible for the Win32 DLLs of the operating system, COM, and various.NET languages to all communicate with one another. • Language interoperability enables seamless communication between software modules written in different.NET languages. A program created in one.NET language can use and even inherit from a class created in another.NET language as long as certain requirements are met. The.NET Framework's ease of integrating modules written in different computer languages has earned it the moniker "language-agnostic." • Platform invoke (P/Invoke), a feature provided by.NET, allows.NET programmes to interact and make use of. It may import standard Win32 DLLs like the Windows APIs that contain unaltered C functions. Compatibility with COM is also possible with the.NET Framework. Software components of the.NET Framework can call COM components and COM components can call.NET components as if they were COM components themselves.

What is difference between abstract class and interface and when should we use interface and abstract class?

Although you can generate derivatives from this, you cannot create an object of the abstract class. Either abstract or non-abstract methods can be found in an abstract class. There is no implementation for abstract members in the abstract class; nevertheless, a derived class must supply one. Both abstract and non-abstract members can be found in an abstract class. The members of an interface, however, must all override the members of its derived class because all interface elements are implicitly abstract in nature. Similar to defining an interface, declaring an abstract class includes all of its abstract members. Specifically, we can say that an interface is a class that has all abstract members. Classes can only descend from one base class, therefore if you wish to use abstract classes to give a bunch of classes polymorphism, they must all all descend from that base class. Members that have already been put into practise may also be offered by abstract classes. With an abstract class

What is the difference between XML Web Services using ASMX and .NET Remoting using SOAP?

XML Web services have more restrictions than objects delivered via.NET Remoting. XML Web services offer open standards that are cross-platform compatible. Because of its constraints, XML Web services are generally easier to implement and present fewer design difficulties. XML Web services only allow SOAP message formatting, which uses lengthier XML text messages. Using a binary formatter to communicate with an XML Web service may be longer than using.NET Remoting. The intended users of XML Web services are companies and other organizations. Because ASP.NET always hosts XML Web services, they don't require a different hosting solution. Customers can get XML Web services and HTML pages from the Internet with equal ease. Therefore, an administrator does not need to open additional ports on a firewall as they use MS-IIS and ASP.NET. NET Remoting is not created with interoperability in mind.   Services created with.NET Remoting cannot be used by clients that are not.NET, despite the tra

What is the difference between Finalize() and Dispose()?

The dispose() function is used by an object when it needs to release any unmanaged resources it has been holding. Despite having the same purpose as discard, finalise() does not ensure that an object will be removed from the trash. Dispose() often works better because it has deterministic behaviour. A type's Dispose method should release all of the resources that it is in possession of. It should release any resources that are a part of its base sorts by utilising the parent type's Dispose method. The parent type's dispose method, which should release any resources it holds and then call the parent type's dispose method, should transmit this pattern down the hierarchy of base types. To ensure that resources are always correctly cleaned up, a Dispose method should be callable several times without raising an exception. A dispose method should invoke the GC.SuppressFinalize function for the object that is being disposed of. The GC.SuppressFinalize flag prevents the Finali

C#.NET - how Obfuscator works

Hackers are barred from the source code via obfuscators. Data can be recovered using encryption and decryption techniques. These, though, do not constitute obfuscation. Hackers cannot access a programme that is disguised while it is still functioning as intended. Throughout the obfuscation process, optimisations are also applied to speed up the code. Obfuscator merely converts all type names, namespace names, and other human-intelligible names to meaningless code. As a result, the possibility of reverse engineering is diminished. Please see the below example, private void AddEmp(Employee employee) { { this.EmpList.Add(employee); } } gets converted to private void a(a b) { { a.a.Add(b); } }