Developer forum

Forum » Development » Extranet automatic login

Extranet automatic login


Reply

Hi,

 

One of our customers wants to be able to log users automatically in to their extranet. I've read the blog concerning login through IP-address, http://developer.dynamicweb.dk/Weblog-16918.aspx?action=ShowArticle&ArticleID=141.

 

Good post, but still I've got a question. Where do we've got to put the code that's send along with the post, in the Default.aspx, Global.asax or somewhere else?

 

Also, I've came up with a plan to implement an automatic login. Does this way of implementing the login have any chance on succeeding? In the login template we want to create a checkbox for a rememeber me. Next, in the code behind of some page (or in Global.asax?) we want to check on this checkbox. If it's checked, do the stuff from teh login.cs file from the blog. If not, do nothing.

 

Thanks!


Replies

 
Reply

I just happened to have a piece of code lying around:) Put this in Global.asax and use the standard template for logging on Extranet.

 

public void Session_Start(object sender, EventArgs e)
{
 string Filepath = Server.MapPath("/Files/AutoLoginLog.txt");
 try
 {
  HttpCookie MyCookie = System.Web.HttpContext.Current.Request.Cookies["DW_Extranet"];
  if (MyCookie != null && MyCookie.HasKeys)
  {
   string Username = MyCookie["DWExtranetUsername"];
   string Password = MyCookie["DWExtranetPassword"];

   if (Username != "" && Password != "")
   {
    Dynamicweb.Security Sec = new Dynamicweb.Security();
    Sec.ExtranetLogin(Username, Password);
    if (Session["DW_extranet_AccessUserID"] != null)
    {
     HttpContext.Current.Response.Cookies["DW_Extranet"].Expires = DateTime.Today.AddDays(30);
     HttpContext.Current.Response.Cookies["DW_Extranet"]["DWExtranetUsername"] = Username;
     HttpContext.Current.Response.Cookies["DW_Extranet"]["DWExtranetPassword"] = Password;
    }
   }
  }
 }
 catch (Exception EX)
 {
  Dynamicweb.Base.WriteTextFile(EX.Message + "\nline\n" + EX.StackTrace + "\n", Filepath, true);
 }
}

 

 
Reply

Thanks!

 
Reply

No problem. Let me know how it works out for you:)

 
Reply

The customer will implement and test it, but I'll let you know when we're getteing some feedback!
 

 

In the meantime, I also posted a question last friday on which I didn't get an answer yet. Do you have any idea on yhe subject? --> http://developer.dynamicweb.dk/Forum-17061.aspx?action=ShowThread&ThreadID=1238

 

Thanks!

 
Reply

I saw the posting, but didn't have the silver bullit:) Maybe you should contact the support department about this question.

 
Reply

At the cost of sounding like a beginner:
Where is the global.asax file in a normal setup? I can only find globalsettings, when I poke around with FTP access.

 
Reply

Global.asax is not accessible in regular installations, only on custom installations. Contact helpdesk if you want to convert a solution into a custom solution.

 

You must be logged in to post in the forum