.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Reverse C# Connection Question

Posted By:      Posted Date: September 18, 2010    Points: 0   Category :.NET Framework
Hi I am coding a  C# Reverse Connection Tool and it is working fine only when connecting within LAN (ex. 192.168.1.x) . When I use host like no-ip or dyndns or direct ip address it will not connect ? Any ideas ?  I have properly configured my router to forward the host connection to my LAN computer and the 3 ports are opened!     Here is how I initialize the connections : private void InitializeConnection() { try { IPHostEntry hostInfo = Dns.GetHostEntry(""); IPAddress ipaddress = hostInfo.AddressList[0]; //MessageBox.Show(ipaddress.ToString()); // Start a new TCP connections to the chat Client tcpClient = new TcpClient(); tcpClient.Connect(ipaddress, 8000); tcpClientFileView = new TcpClient(); tcpClientFileView.Connect(ipaddress, 8001); tcpClientCommunication = new TcpClient(); tcpClientCommunication.Connect(ipaddress, 8002); // Helps us track whether we're connected or not connected = true; Thread clientThread = new Thread(new ParameterizedThreadStart(HandleClientComm)); clientThread.Start(tcpClient); Thread fileViewThread = new Thread(new ParameterizedThreadStart(HandleFileView)); fileViewThread.Start(tcpClientFileView); } catch (Exception e) { tcpClie

View Complete Post

More Related Resource Links

connection string question from a newbie


when publishing  in the webmatrix dialogue it asks for "destination connection string" for my "database.mdf"

I was not sure what it was so I pasted this from my web.config file :

Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\database.mdf;Integrated Security=True;User Instance=True

it all published ok, but wont run, so I guess it has somthing to do with this connection string or some kind of configuration issue.

My question is this, What should go in the field for "Destination connection string"

101 question - New to VS 2010, create connection string to perform test with Oreilly txt book

Hello, I have installed VS 2010 Ultimate and it came with SQL 2008.  I am trying to figure out what version it is and also how to create a connection in place to keep using the Oreilly examples to hopefully learn how to develop in C#.  I have been learning but it is getting more difficult.   I try to follow the steps but it just does not make sense.  If anyone could provide some easy steps to check version and connection method to sql using 2010, I would be grateful. I did see a post for sql management(http://www.microsoft.com/downloads/details.aspx?FamilyID=08e52ac2-1d62-45f6-9a4a-4b76a8564a2b&displaylang=en).  I am going to download to hopefully be able to view the database.  We have sql server 2008 at work and I have used the studio management for sql to run queries and would like to do the same with the version that was installed with the installation of 2010 ultimate.Hopefully I can get the connection to the database so I can start learning how to build a dictionary and list for some queries.  My goal is to create a aspx file that will show entries in a database we have at work.  Trying to take baby steps.Thanks for the help.

C# reverse connection remote screen capture tool


Hello , I am coding a reverse connection remote screen capture tool.The server can connect to the client but I cannot make screen capture to work. can someone help me out? this is my code :

<strong>using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Net;
using System.Net.Sockets;
using System.Threading;
using System.IO;

namespace ScreenCap_Client
  public partial class Form1 : Form

    private TcpListener captureListener;
    private TcpListener severListener;

    private TcpClient tcpServer;

Training Question - Connection Refused Error in Browsing A Cube In SSAS


I am an instructor for a data warehouse design and implementation course at a local college, and I have run into a problem that I have not been able to fix.  Hopefully someone out there can help.  It is the first time this course is being taught in a new lab where we are running SQLExpress 2008 Developer Edition, with a local server instance installed on each workstation, using Windows authentication; this configuration was done by our local LAN/network manager.  We have created a Management Studio source database and a Management Studio warehouse database, using a star schema design.  We have successfully created SSIS packages to extract from the source tables and populate the warehouse tables.  We have been able to create a DSV in SSAS.  When we attempt to process and browse the cube, it fails with a connection refused error from the server.  Configuration Manager tells me the SSAS server process is running.  The data connection works when checked.  We get the same error regardless of which impersonation option is selected. What have I missed?  Can the configuration be adjusted to get around this?  I have spent several hours trying everything I could think of, with no success - it is getting frustrating.

Please advise.  Thanks in advance.

SQL Connection String

We can learn or know how can we connect the database from our .net. This will help for freshers or .NET beginners!

abstract away the source of the connection string using a class with a static property.

ASP.NET provides a configuration system we can use to keep our applications flexible at runtime. In this article we will examine some tips and best practices for using the configuration system for the best results.

The element of a web.config file is a place to store connection strings, server names, file paths, and other miscellaneous settings needed by an application to perform work. The items inside appSettings are items that need to be configurable depending upon the environment, for instance, any database connection strings will change as you move your application from a testing and staging server into production.

Let's abstract away the source of the connection string using a class with a static property.

Some basic MVC question

  1. In regular asp net I can run (debug) the application but I can either "view in browser" that gives me the option to view the application and write code on same time.

In MVC I can't find this option.

  1. What is the basic DATA MODEL for working with SQL DB.

I mean with no any framework (entity framework, Sub sonic, Link to SQL etc')

I look for basic application that works with data but with no fw.

  1. What is the popular DB framework that working with data.
  2.  I am looking on  mvc series


C# Soup To Nuts  (the best series ever)


I watch some of the MVC video, seems that the music store is good but I have to wait to the other part.

Does any one know and recommend   a Microsoft MVC tutorial?





Web Site to Web Application Question


I've been building web sites and for my next project I will be creating a web application.  I use a 'BasePage' class in all my projects but, since web applications do not contain the 'App_Code' folder, what is the best place/practice for the 'BasePage' class?



Security Question Answer Retrieval


I know there is a method built in for retrieving the encrypted password, but how do I retrieve the encrypted security answer?

What I want to do is have a member profile update screen that the end user can update their password and security question and answer. However, when they get to this page, I want to already be showing the security question (the easy part) and its answer (the not so easy part).

I have updated web.config with passwordFormat=Encrypted and have added a machineKey with the generator (forgot the link, but located on eggheadcafe somewhere).

I haven't done ANYTHING yet, since I already have a user store with hashed information. I wanted to get some functionality done before publishing, wiping the store and recreating users (only a couple developers).


Very Basic Question - Error message running first page


Hi Everyone,

I am running Windows 7 and I have gone into Control Panel and activated all of the IIS Functions.

The web application I am running was downloaded from the net (and has worked on other machines previously).  Once I downloaded it, I moved it into C:/inetpub/wwwroot/code/main.asp

I am a bit of a novice at this!  But I am hoping someone can point me in the right direction!


I get the following error when I try and run the web application through IE:

"An error occurred on the server when processing the URL. Please contact the system administrator. If you are the system administrator please click here to find out more about this error."

(When i click the "click here" button it just goes to the IIS site).


Appreciate any help I can get!




localhost is not set up to establish a connection on port 51624 with this computer


I'm trying to run asp.net locally, but getting the error

localhost is not set up to establish a connection on port 51624 with this computer

How can I fix it?

C#, LINQ: (List<>) Question???


Hi Everyone,

I have a strange problem:


There is an entity (Table) called "Filters" in my .edmx which has all my tables and stuff in it (to use it for LINQ queries)

I have created a class called "CustomFilters" which inherits "Filters". So now my cutom class has all the properties of the original "Filters" class (table) and 1 more additional property that i wanted which is a List of "CustomFilters":

List<CustomFilters> children = new List<CustomFilters>();

Now i get all my records into:

List<CustomFilters> theOriginalList = new List<CustomFilters>();

NOTE: first all records are tken into a List<Filters> and then these are added into List<CustomFilters> where List<CustomFilters> for children of that record is added, and then children of the child records, and so on......

so now, every record is an instance of CustomFilters which has a property named "children" which is a list again; and each child again has instanaces of "CustomFilters", and each instance again has children...and on and on and on.....

(basiacally its a data source for a treeview in my silverlight control)

every thing is good and working as expected.


connection to SQL Server files (*.mdf) require SQL server express 2005 to function properly.


I dont have the SQL EXPRESS installed instead I have SQL Standard Edition.

 I have two SQL Server instances installed.

 1- UserLT (this is sql 2000)
2- UserLT\SQL2005 (this is SQL 2005 named instance)

But when i try to add a database to my VS website project I get the following error:

Connection to SQL Server files (*.mdf) require SQL server express 2005 to function properly. please verify the installation of the component or download from the URL: go.microsoft.com/fwlink/?linkId=4925

I went in Tools>Opetions>DataBase tools>Data Connection>Sql Server Instance Name (blank for default)

and changed the "SQLEXPRESS" to "USERLT\SQL2005".

But I still get the same error message. Any ideas how i can resolve this issue?

linqdatasource parameters question



I'm currently getting to know the linqdatasource control. What would happen if several WHERE parameters are added to the linqdatasource control declaritively in the aspx page but no WHERE clause is defined? 

1. is there any issue with setting up multiple WHERE parameters in the aspx markup for linqdatasource but then deciding which ones actually get used at runtime by setting the actual WHERE clause at run time? Would the unused parameters simply be ignored and cause no issues?

2. when you need to modify WHERE clause or WHERE parameters at runtime do you need to do so in an event handler? such as linqdatasource.selecting?
I see from the above link it is possible, but is that the standard way to handle controlling filtering in code behind for linqdatasource?

2b. if you use an event such as linqdatasource.selecting to add where parameters and/or modify the where clause in code will that also break the builtin sorting and paging support of the linqdatasource with a gridview? 

Unable to make connection to database?


Hy guys. I try to connect my database for so long so i wrote two type of codes. Let's discuse first on.

I have database called PhoneDirectory.

It have only one table named Residents.

I have button wiht ID="Button1".

I want when i click this button to see all of my residents. 

I want to see the result in DetailsView and to be able to edin, delete and add new resident.

First try with SqlDataSource so i wrote this:

<asp:SqlDataSource ID="Resident Details" runat="server" ProviderName="System.Data.SqlClient" ConnectionStrings="<%$ ConnectionStrings:ThisIsTheConnection%>" 
              SelectCommand = "SELECT * FROM Resident "

Need Oracle Data Provider .CS File for Oracle 10g Database connection !



I need a 'Wrapper.cs' file which takes care of the Database connection ( Oracle 10g) where

i can just call the method with my SQL Query


Gridview1.DataSource = SampleWrapper.ExecuteDatatable("THE SQL QUERY");


Plz Post the link if there is any open source !    

database interface design question


For handy database interface, is it good to use SqldataSources exclusively intead of EntLib functions?

Thanks for any feedback.

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend