• 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
https://www.neowin.net/forum/topic/796750-cnet/
Share on other sites

8 answers to this question

Recommended Posts

  • 0

Under the hood, thats what I believe it is doing. When you use native APIs from managed code, you do so through Platform Invoke (http://msdn.microsoft.com/en-us/library/aa288468%28VS.71%29.aspx), or P/Invoke. Would it not be easier to use a managed wrapper then trying to build one yourself?

Link to comment
https://www.neowin.net/forum/topic/796750-cnet/#findComment-591273168
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
https://www.neowin.net/forum/topic/796750-cnet/#findComment-591273310
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
https://www.neowin.net/forum/topic/796750-cnet/#findComment-592253156
Share on other sites

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

    • No registered users viewing this page.
  • Posts

    • WebChangeMonitor 26.06 by Razvan Serea Monitors allows you to quickly check a number of web pages and tracks changes based on the content of the web pages. Allows to monitor several protocols, including HTTP and HTTPS. Allows to view and record differences. Available for Win7/10, Linux and others. WebChangeMonitor features: Allows monitoring of web pages and informs about content changes Indication of states of currently monitored items in the tool and taskbar Reporting as sound and/or email as well as log file or HTML log Several configuration / filter options Support all protocols, e.g. http, https Multi-threaded, running in the background Bulk-import and bulk-export of items (from/to CSV) to monitor Export of results to CSV file for further processing Allows running command on items states and/or showing diff (changes) of content with preferred diff-tool ...and many more! Open Source (C++, wxWidgets) Cross platform for Windows (7/10), Linux, RPi and Mac (if self-compiled) WebChangeMonitor 26.06 release notes: Release 26.06 brings mostly s but updates the underlying core infrastructure. A major compiler is used for both x86/x64 and WoA64 architectures. This also means that all core libraries are re-compiled accordingly which required some changes in the build scripts. One of the core libraries (cURL) has been updated to address vulnerabilities and a nasty linker error that was causing the need for a dedicated patch which could now be eliminated. Download: WebChangeMonitor 64-bit | Setup 64-bit | ~10.0 MB (Open Source) Download: WebChangeMonitor 32-bit | Setup 32-bit View: WebChangeMonitor Website | Other Operating Systems | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • BATorrent 3.0.4 is out.
    • yea they change their app to high-system app so you can't disable with adb or within android, you gotta get root be able to do disable this high-system app now if you have locked down boot loader you screwed. samsung started locking down their store and their account app extremely annoying, account constantly nagging you to sign in... i disable all ai core apps and especially gemini since you can't uninstall anymore. i hope some day someone will present a bill force this companies quit locking down this damn phone especially the apps...
    • It's basically the only web browser project not controlled by a major corporation.
  • Recent Achievements

    • Dedicated
      Mark Spruce earned a badge
      Dedicated
    • Collaborator
      conkir earned a badge
      Collaborator
    • Rising Star
      olavinto went up a rank
      Rising Star
    • One Month Later
      lamborghiniv10 earned a badge
      One Month Later
    • Week One Done
      lamborghiniv10 earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      482
    2. 2
      PsYcHoKiLLa
      257
    3. 3
      Steven P.
      74
    4. 4
      +Edouard
      69
    5. 5
      Skyfrog
      68
  • Tell a friend

    Love Neowin? Tell a friend!