• 0

[c#.net]


Question

hi!

i am trying to make a dial up connection using wininet functions like internetdial() and etc.

but when i use internetdial(), dial up connection dialog box pops up which i don't want in my application.

what i want is to get all the entries of dial up connections connected to a system and then i want user to select the connection he want to connect with.

But i am not able to find any such function or some other way through which i can get all the dial up connection entries(actually just the name of all the connections).

I have searched the net but i have found nothing ..can anyone help me out in this problem.

pls provide some solution..

thanks!

Link to comment
Share on other sites

8 answers to this question

Recommended Posts

  • 0

hmm.. may be you are right Antaris!

i went through various functions of RAS and i am not so sure which one to use..can you pls reply and tell me which of the function can help me out and how can i use RAS in my application.

Link to comment
Share on other sites

  • 0

From my (very brief) look over the code, you should be able to enumerate the available entries using the RasPhoneBook type, and use the RasDialer type to perform the call:

public IEnumerable<RasEntry> GetAvailableEntries() 
{
	using (RasPhoneBook phoneBook = new RasPhoneBook()) 
	{
		phoneBook.Open();

		return phoneBook.Entries;
	}
}

You can then code a dialer that accepts one of those entries:

public class Session 
{
  #region Properties
  public RasDialer Dialer { get; set; }
  public RasEntry Entry { get; set; }
  #endregion

  #region Methods
  public void Connect()
  {
	  using (RasPhoneBook phoneBook = new RasPhoneBook())
	  {
		  phoneBook.Open();

		  Dialer.Entryname = Entry.Name;
		  Dialer.PhoneBookPath = phoneBook.Path;

		  Dialer.Dial(); // or Dialier.DialAsync();
	  }

  }
  #endregion
}

That should get you started, what I would do though, is look at the sample code DotRas is packaged with, should point you in the right direction.

Hope that helps.

Link to comment
Share on other sites

  • 0

Thank you much for your reply! i will try and inform about any further success i'l get.

i have gone through the various RAS functions and found RasEnumConnections..can this be helpful???

Link to comment
Share on other sites

  • 0

You probably won't need it, if you are enumerating the phonebook entries (thus, the dial up connections, etc.), you should be able to bind them to a list of some sort, and then have the user select one of them, which you then pass to the dialer.

Link to comment
Share on other sites

  • 0

You probably won't need it, if you are enumerating the phonebook entries (thus, the dial up connections, etc.), you should be able to bind them to a list of some sort, and then have the user select one of them, which you then pass to the dialer.

need to connect web via RAS. But any simple codes doesn't work. Can you help me please? you can download DOTRAS from http://dotras.codeplex.com/ also add reference and use it.

This codes doesn't work:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;
using System.Runtime.InteropServices;
using DotRas;

namespace RasTestsConsole1
{
    class Program
    {
        static void Main(string[] args)
        {
            using (RasDialer dialer = new RasDialer())
            {
                foreach (RasConnection connection in dialer.GetActiveConnections())
                {
                    RasIPInfo info = (RasIPInfo)connection.GetProjectionInfo(RasProjectionType.IP);
                    if (info != null)
                    {
                        Console.WriteLine("Client: {0}", info.IPAddress.ToString());
                        Console.WriteLine("Server: {0}", info.ServerIPAddress.ToString());
                    }
                    else
                    {
                        Console.Write("hata");
                    }

                    Console.ReadKey();
                }
            }
        }
    }
}

Original code source page: http://dotras.codeplex.com/wikipage?title=Getting%20Started

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.