Skip to main content

AddToAny

Share/Save

C#.NET

Path Combine: Leading Slash in relative path

System.IO.Path.Combine is one of the scarcely used method provided by .Net Framework. It is used to combine two strings in to a complete path. Path.Combine is also essential for cross-platform coding as it uses whatever path separator the current OS uses.

 

Error : Unable to connect to the remote server

I got "Unable to connect to the remote server error" when I tried to call a webservice that is hosted on some remote machine outside my firewall. I am using a proxy server, and figured it that my application is not aware of the proxy server. So I did some googling and add the following defaultproxy settings under System.net tag in applications web.config file.

Linq query on Datatable

Posted in

How to query a Datatable using LINQ? I have added the system.Linq namespace, but I am not able to use LINQ on a datatable.

RowNumber Alternative in Linq

I want to know, Do we have any alternative to Row_Number function in Linq. I want to use Ranking and Partition in Linq.

 

SELECT ROW_NUMBER() OVER(Partition BY Author_Name

Please let me know how to achieve the same functionality in Linq.

What is the real use of Polymorphism.

Posted in

Though I know What polymorphism is, but I am not able to comprehend the real significance of it.

I could manage functions with different names, then why should I use polymorphism.

 

How to create a session variable in ASP.NET

  1. Define an ASP.NET web site.
  2. Create two pages within the site. The first page will contain an ASP.NET Web Form that will post back to itself and then redirect to the second page.

    Note: The reason this example uses two pages is to prove that a session variable is available to a second, third, fourth, etc. page in the web site. Request variables, which are an alternative to session variables, cannot be carried over from an ASP.NET Web Form on one page to a second page

"FormatException was unhandled" Input string was not in a correct format.

Hi ! Here I am trying to write a function that returns me value based on the following condition... IF Variable is NULL return me DBNull.Value ELSE Convert Variable into DataType whose DataTypeCode has been provided to me as a parameter of function. Now while converting a variable into required DataType an exception is thrown "FormatException was unhandled". Input string was not in a correct format. How do I resolve this error please help. Here is my code...

public object ReturnDBNullOrRequiredDatatype(object IsThisObjectANull, TypeCode DataTypeCode)
 
{

Syndicate content