Menu

#2 Authentication needed

open
None
9
2006-07-26
2006-07-24
Joseph Gama
No

If the Sharepoint Server requires authentication the
app will fail with a 401 error. It could have a menu
with an option to store the authentication data (but
not to keep it in a file): the user name, password and
domain.

Discussion

  • Joseph Gama

    Joseph Gama - 2006-07-25

    Logged In: YES
    user_id=917965

    This worked for me:

    add a reference to 'Microsoft.VisualBasic.dll'

    On main.cs add:
    using System.Net;
    using Microsoft.VisualBasic;

    On btnGo_Click at the very begining:
    bool AuthFlag = false;
    try
    {
    _Site = txtSite.Text;
    initListService();
    XmlNode lists = ListService.GetListCollection();
    }
    catch (Exception ex)
    {
    if (ex.Message == "The request failed with
    HTTP status 401: Unauthorized.")
    AuthFlag = true;
    }

    On btnGo_Click, after initListService(); :
    if (AuthFlag)
    {
    string StrUser =
    Interaction.InputBox("User name?", "Authentication", "", -1,
    -1);
    string StrPWD =
    Interaction.InputBox("Password?", "Authentication", "", -1, -1);
    string StrDomain =
    Interaction.InputBox("Domain?", "Authentication", "", -1, -1);
    NetworkCredential n = new
    NetworkCredential(StrUser, StrPWD, StrDomain);
    _ListService.Credentials = n;
    }

     
  • Joseph Gama

    Joseph Gama - 2006-07-26
    • assigned_to: nobody --> jgama
     
  • Joseph Gama

    Joseph Gama - 2006-07-26

    Logged In: YES
    user_id=917965

    code to be attached

     

Log in to post a comment.