Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Authenticate through DNN to custom appAuthenticate through DNN to custom app
Previous
 
Next
New Post
8/17/2006 10:33 AM
 

I have created a custom db application and created an application on my webserver.  I have placed the directory on the root which right now our DNN is installed.  I setup the membership to point to the DNN membership database and also copied the machine key from the DNN web.config to my custom app web.config.  But it still doesn't authenticate....

Is this possible to do?

my main site is www.domain.com and then I have the custom app as www.customapp.domain.com.  Through my readings I thought I understood as long as I use the same machine key it should work.

What am I missing?

 
New Post
8/18/2006 1:18 AM
 

The actual signing in in DNN Uses this method to authenticate (in VB for DNN)

System.Web.Security.FormsAuthentication.SetAuthCookie(m.LoginName, false);

In order for the sub domain to read the same cookie as the top domain you have to se the cookie.Domain property to ".domain.com" this will tell all the sub domains to use the same cookie information ( I think the cookies called ASPNETSESSION or something.) The dot tells all sub domains to use this cookie.

Adding some code to the /admin/security/signin.ascx control at the end of the         
      Private Sub cmdLogin_Click(ByVal sender As Object, ByVal e As EventArgs) Handles cmdLogin.Click
method

like

//set the cookie to be used across domains..
HttpContext ctx = HttpContext.Current;
if (ctx != null)
{
   //set cookies to the top domain configured in the web config.
   foreach (string ck in ctx.Response.Cookies.Keys)
   {
      
((HttpCookie)ctx.Response.Cookies[ck]).Domain = ".domain.com"   //Config.GetSetting("Domain");
   }
}

 

Also your custom App will have to use the same authentication methods.. I think the cookie just stores the username.

You may be able to read the username from the cookie and log them in that way, or just use the same cookie to authenticate, it is just the standard windows authentication (I think), so using the windows methods may be the way to go.

 

 

 


 

 
New Post
8/23/2006 1:18 PM
 
Thank you for responding and I hope I can implement this....do you know how the code would be written in VB.NET
 
New Post
8/23/2006 9:10 PM
 

courtesy of http://www.carlosag.net/Tools/CodeTranslator/Default.aspx

Dim ctx As HttpContext HttpContext.Current
If (Not (ctx) Is Nothing) Then
    
'set cookies to the top domain configured in the web config.
    
For Each ck As String In ctx.Response.Cookies.Keys
        
CType(ctx.Response.Cookies(ck),HttpCookie).Domain ".domain.com"
        
'Config.GetSetting("Domain");
    
Next
End If

If you can't translate that, you may have some trouble implementing it, but good luck.


 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Authenticate through DNN to custom appAuthenticate through DNN to custom app


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out