How to authenticate to microsoft active directory through iOS App?

Someone asked on Stack Overflow:

I am to authenticate username and password credentials to a Active Directory through the iOS App?

I know that this post instructs us to include the openldap in the project, BUT this post here has indicated that there are inbuilt ldap protocol that I can use to connect with the Active Directory using PHP.

Can somebody shed light on both of the topics, and pick one which would be useful for the current version of XCode.

And also, are there any examples of this that any user can share?

P.S: This is my first question in stackoverflow.

I posted the following answer, which was chosen as the accepted answer and received 1 upvote:

Unless you are exposing your domain on the Internet, you’ll need some sort of service layer. If you know php, that is probably a good route to go. Then, from the iOS application, you simply call the operations exposed through your php server. For creating the service, you may want to look into an ldap library for php.


Originally posted on Stack Overflow — 1 upvotes (accepted answer). Licensed under CC BY-SA.

Road Warrior VPN Setup

Someone asked on Server Fault:

I apologise up front for the rather open ended nature of this question but I’ve got well out of my depth and could really do with some pointers.

I need to set up a road warrior VPN solution which will allow our customers to securely access a number of services we provide for them. Customer machines will be running a variety of Windows versions from XP onwards with a variety of patch levels. Typically they will connect from the clients main offices but not always. It is safe to assume that all clients will be behind NATs but we may occasionally see a connection that isn’t NAT’ed. Typical connection situation is therefore:

Customer Laptop — Router (NAT) — Internet — VPN Server + Firewall — Server (Win 2008 R2, Non-routable IP)

There will initially be a dozen or so people that could connect but that will grow quickly to around 100. It’s unlikely that we’ll see that many concurrent connections though, I imagine our total VPN throughput would be <50Mbps peak.

What are my options for setting this up?

I’ve been trying to set up a system like this using a MikroTik router for a few days but have struggled to get it working correctly, particularly with NAT’ed clients. I’ve had a quick look at OpenVPN and liked what I saw but I think it’s unlikely our customers IT departments would allow the client to be installed. Finally I’ve looked at the Cisco ASA range but I’m on a fairly tight budget so this is less preferable but it looks like it would work pretty much out of the box. My fall back position is to connect the server directly and use the provided VPN + Firewall facilities but that is far from ideal as the number of servers is likely to grow over time.

I posted the following answer, which was chosen as the accepted answer and received 1 upvote:

What is wrong with installing OpenVPN clients? I would find out from your customers if this is an option, because it will be cheap and probably do what you want… though there is some configuration required (I haven’t ever done it, but I’ve read about it being pretty good).

On another note, I’ve used Watchguard firewalls with mobile VPN, and been pretty happy. It works just fine when the clients are behind NAT. They aren’t cheap, but they are less expensive than Cisco.


Originally posted on Server Fault — 1 upvotes (accepted answer). Licensed under CC BY-SA.

How would I share ports between my IIS applications?

Someone asked on Server Fault:

By request of our network administrator, I would like to do so unless someone could give me a strong argument against it.

  • What should i watch out for?

I posted the following answer, which was chosen as the accepted answer and received 2 upvotes:

The only way to do this is by creating a unique binding. If the port and IP are the same, the host header (dns entry) must be different.

I am unaware of any downsides to this approach. Especially if you do not have enough IPs to service every application you need to run.


Originally posted on Server Fault — 2 upvotes (accepted answer). Licensed under CC BY-SA.

Using LINQtoCSV in MvcScaffolding ASP.NET Web Page

Someone asked on Stack Overflow:

I’m trying to add a link to a basic MvcScaffolding project that outputs all data from a IQueryable interface. The controllers are built with Scaffold Controller Sales -Repository and have nothing out of the ordinary in the Sale class, just a few strings and some integers. Everything in the project works as expected.

From posts I’ve found, LINQtoCSV could be a possible solution for me (http://www.codeproject.com/Articles/25133/LINQ-to-CSV-library). Unfortunately, I don’t know what to add. If I have a link on the index page of /Sales/ that points to /Sales/CSV/, how can prompt the user with “Download or Open”?

I also saw this page (http://www.asp.net/web-api/overview/formats-and-model-binding/media-formatters) that tells how to build a Web API, but I cannot use MVC 4 per company standards.

The code I currently have in SalesController.cs is the following (which errors with [DirectoryNotFoundException: Could not find a part of the path 'C:\...\Sales\CSV\LINQtoCSV.CsvContext'.]):

    //
    // GET: /Sales/CSV/
    [Authorize]
    public FilePathResult CSV()
    {
        List<Sale> dataRows = saleRepository.All.ToList();

        CsvFileDescription outputFileDescription = new CsvFileDescription
        {
            SeparatorChar = '\t', // tab delimited
            //EnforceCsvColumnAttribute = false,
            FirstLineHasColumnNames = true, // no column names in first record
            FileCultureName = "en-US" // default is the current culture
        };
        CsvContext cc = new CsvContext();

        cc.Write<Sale>(dataRows,
            "output.csv",
            outputFileDescription);

        return File(cc.ToString(), "text/csv");
    }

EDIT: Modified code to create list from repository and output using File().

EDIT: This is the modified code that I’m using. In the model, I’m building the string with a joined list. The controller code is as follows:

    [Authorize]
    public FileStreamResult CSV3()
    {
        MemoryStream output = new MemoryStream();
        StreamWriter writer = new StreamWriter(output);
        saleRepository.All.ToList().ForEach(s => writer.WriteLine(s.ToStringCSV));

        writer.Flush();
        output.Position = 0;

        return File(output, "text/csv", "report.csv");
    }

I posted the following answer, which was chosen as the accepted answer:

Maybe you need to use the FileResult class? See also How to create file and return it via FileResult in ASP.NET MVC?


Originally posted on Stack Overflow — 0 upvotes (accepted answer). Licensed under CC BY-SA.

How to resize form in scale? C#

Someone asked on Stack Overflow:

i need that in my form the width is twice the height (1:2) also when i resize How i can do that? Thanks for help and sorry for my english :)

I posted the following answer, which was chosen as the accepted answer:

Checkout the Control.Resize event — also

private void Form1_Resize(object sender, System.EventArgs e)
{   
    Control control = (Control)sender;
    control.Width = control.Height * 2; 
}

Originally posted on Stack Overflow — 0 upvotes (accepted answer). Licensed under CC BY-SA.

Is there a reason to give a VM a round base-2 amount (2048MB, 4096MB, etc) of memory?

I asked this on Server Fault:

The title pretty much says it all, is there any advantage to giving a VM 2048MB of memory instead of rounding to base-10 and doing 2000MB?


Chris S answered (10 upvotes):

The physical memory in the server is a multiple of a power of two, so it will slice evenly if you use other multiples. There may be some incredibly minor improvements with SLAT and such if they’re properly aligned too. Otherwise no.


Originally posted on Server Fault — 27 upvotes. Licensed under CC BY-SA.

how i add new full contact to WP with C# code?

Someone asked on Stack Overflow:

I want to add new contact to WP’s contact list with C# code. but not with SaveContactTask or SavePhoneNumberTask or etc.

I want to add advanced contact to WP contact database. How can I get access to Contact Database of Windows Phone to save my contact data ?

I posted the following answer, which was chosen as the accepted answer and received 3 upvotes:

The only way this is possible is through the SaveContactTask. Windows Phone limits applications access to many of the functions of the underlying OS’s data.


Originally posted on Stack Overflow — 3 upvotes (accepted answer). Licensed under CC BY-SA.

Does a SQL Server bit column really use a whole byte worth of space?

I asked this on Database Administrators:

I was poking around SSMS and noticed the “size” of my INT columns were 4 bytes (expected) but I was a bit shocked to see my BIT columns were a whole byte.

Did I misunderstand what I was looking at?


SQLRockstar answered (17 upvotes):

How many bit columns do you have defined in the table? I found this on MSDN, it says 8 or less bit columns are stored as one byte.

http://msdn.microsoft.com/en-us/library/ms177603.aspx


Originally posted on Database Administrators — 20 upvotes. Licensed under CC BY-SA.

Should I use jQuery controls instead of HTML/asp.net controls in most situations?

Someone asked on Stack Overflow:

I’m relatively new to jQuery. To me, there’s three sets of controls (html controls, asp.net controls, and jQuery controls). To build an asp.net web page, how should I choose which one to choose from if these three all have the same control (e.g., button). In other words, in what situation should I pick one over the others?

I posted the following answer, which was chosen as the accepted answer and received 2 upvotes:

My approach is to always use basic html in as many situations as possible. ASP.NET and jQuery controls end up generating standard html controls in the end, they just abstract away some aspects. Without a more specific question, it is very hard to say what you should use. It is probably not what you want to hear, but you need to better understand the differences between these three types and make pick the best option for the situation at hand.

That said, I find myself using standard html input controls as much as possible, and using jQuery for client-side interactions. With ASP.NET MVC this is much easier than WebForms; though it’s possible in both. If you’re in WebForms you may wish to use the built-in ASP.NET controls.

Notable comments

Nate (0 upvotes): @lwconquer, yes. In general jQuery is much more popular with MVC; there is no technical reason. WebForms has the built-in controls so the other controls are not always needed. That said, jQuery can be used in conjunction with WebForms controls.


Originally posted on Stack Overflow — 2 upvotes (accepted answer). Licensed under CC BY-SA.

Mobile Web app with JQuery Mobile and C sharp

Someone asked on Stack Overflow:

I’m thinking of developing a mobile web app. I was wondering if it is possible to create the front-end of the application using jQuery Mobile and create the Back-end using C Sharp that will connect to an SQL Server. This app will be based on a 3 Tier Structure meaning Presentation Layer, Business Logic Layer and Data Access Layer. All database operations will be done using LINQ.

I posted the following answer, which was chosen as the accepted answer:

This is possible. In fact, it is common and a good practice to break up your different layers. I recommend that you look at the following: http://www.asp.net/mvc/ — you can get all the tools you need.

ASP.NET MVC will help break up your Presentation (Views) from your Business Logic (Controllers) and your Data Access Layer becomes your Model.


Originally posted on Stack Overflow — 0 upvotes (accepted answer). Licensed under CC BY-SA.

signed letter b

Dad. Geek. Gamer. Software developer. Cloud user. Old Car enthusiast.  Blogger.


Top Posts


profile for Nate on Stack Exchange, a network of free, community-driven Q&A sites
a proud member of the blue team of 512KB club
Thoughts, opinions, and ideas shared here are my own. © 2026 Nate Bross.