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

HomeHomeDevelopment and...Development and...DNN Platform (o...DNN Platform (o...Impersonate functionImpersonate function
Previous
 
Next
New Post
5/19/2010 7:13 PM
 
Hi,
I don't know if i am asking this in the right forum. I need to access a directory that is on a network UNC path. I need to impersonate the current user just for the duration of the method that reads a file from the path.  This path is accessible and read/writable from windows file system but not from the web site. Is there a function that DotNetNuke provides for impersonating the logged in user?
Currently, we are using Framework 5.14 since that is when we started development.
thanks,
bramoin
 
New Post
5/20/2010 10:25 AM
 
DotNetNuke does not have any functionality for this, but a quick google search should get you an example of how to temporarily impersonate a user.

Just be sure to destroy the handle to the user properly so you don't leak resources.

-Mitchel Sellers
Microsoft MVP, ASPInsider, DNN MVP
CEO/Director of Development - IowaComputerGurus Inc.
LinkedIn Profile

Visit mitchelsellers.com for my mostly DNN Blog and support forum.

Visit IowaComputerGurus.com for free DNN Modules, DNN Performance Tips, DNN Consulting Quotes, and DNN Technical Support Services
 
New Post
5/20/2010 1:17 PM
 
Our colleagues have setup the web.config as follows:

<authentication mode="Forms">
<forms name=".DOTNETNUKE" protection="All" timeout="60" cookieless="UseCookies"/>
</authentication>

This makes it so i can not get the windows username and password, therefore i can not impersonate. Is there a reason this is setup this way?
Can we set the mode to "Windows". If so, what do we need to do to make things still work?
thanks,
bramoin



 
New Post
5/20/2010 2:51 PM
 
I figured out this problem.  Please ignore this. I just want to include the solution if you are ok with it.  I was trying to check a directory using Directory.Exists .NET API. The call would return false.  I was trying to impersonate the windows logged on user in code but this is not possible when the mode is set to Forms.  
I added this line to my Default.aspx file
<asp:label id="myUserId" ><%= Environment.UserName %> </asp:label>
This gave me USR_account and this told me that the ASPNET account security is not using the integrated windows. When i set the account security on IIS to use only windows integrated security then my problem went away.
Sorry to have distracted you from your other posts but i think this will come in handy for others who may fall in the same whirlpool.
bramoin
 
Previous
 
Next
HomeHomeDevelopment and...Development and...DNN Platform (o...DNN Platform (o...Impersonate functionImpersonate function


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