[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Setting IIS authentication method

Posted on 2008-10-02
6
Medium Priority
?
338 Views
Last Modified: 2008-11-23
Hi,
I would like to controll IIS authentication method from code or config file.
I need to control the "Integrated windows authentication" to be "Checked" or not. I must do it from the code or config file. (of course it is not mandotory to be "checked at the IIS directory security GUI)
When it is not checked I have to allow "Anonymous" access.
All the configuration must be done from a web page that runs under the same configured IIS.
If I need a special authorization please let me know.
Thanks Ranny
0
Comment
Question by:Optibase1
  • 3
  • 3
6 Comments
 
LVL 8

Expert Comment

by:paololabe
ID: 22626775
You could use the adsutil.vbs script
Calli the script throuth the System.Diagnostics.Process class.

the command should be:
cscript adsutil.vbs set [apppath]/authntlm [false|true]

replace st with get to know the current status

Another way could be WMI library.

You should run the aspx pagewith admin permission.

Paolo.
0
 

Author Comment

by:Optibase1
ID: 22633168
Thanks,
where should I make the call or use the vbs file?
Sorry, I'm only familiar with C# or javascript.
If you could make an example I'll be :-)
Thanks again
0
 
LVL 8

Expert Comment

by:paololabe
ID: 22633771
You could create a method in the page (for example ToggleAutentication) and call it when you set the checkbox or postback the page


ToggleAutentication(AnonymousCheckBox.Checked)

Read also this reference http://msdn.microsoft.com/en-us/library/ms525389.aspx explaining hot to use ADSI to explore IIS metabase using c#

...
using System.Diagnastics;
...
private void ToggleAutentication(IsAnonymous bool)
{
  
    ProcessStartInfo startInfo = new ProcessStartInfo();
    startInfo.CreateNoWindow = false;
    startInfo.UseShellExecute = false;
    startInfo.FileName = "cscript";
    startInfo.WindowStyle = ProcessWindowStyle.Hidden;
    startInfo.Arguments = "adsutil.vbs set [apppath]/authntlm " + IsAnonymous.ToSTring().ToLower()
 
    try
    {
        Process exeProcess = Process.Start(startInfo);
        exeProcess.WaitForExit();
        exeProcess.Close();
    }
    catch
    {
        // manage exception
        return;
    }
}

Open in new window

0
Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

 

Author Comment

by:Optibase1
ID: 22633861
Thanks,
I'll try it soon and let you know
0
 

Author Comment

by:Optibase1
ID: 22658826
Hi paololabe,
I cannot really make it work.
If I use the "get" option, where should I expect to see the answer ?
Does any other parameter than "IsAnonymous" should be fill by me?
sorry for bothering...
thanks
0
 
LVL 8

Accepted Solution

by:
paololabe earned 1500 total points
ID: 22742950
I hope that isn't too late !

You could use:
startInfo.RedirectStandardOutput = true
and read the stream startInfo.StandardOutput

 


0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Integration Management Part 2
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses
Course of the Month17 days, 15 hours left to enroll

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question