Small width layout Medium width layout Maximum width layout Small text Medium text Large text
     Search
Downloads Downloads Directory Directory Forums Forums Forge Forge Blogs Blogs        Marketplace Marketplace Careers Program Careers
Community › Forums Register  |  

The best choice for your web site host, email hosting, and domain registration.
  Need Help?  
Professional technical support for DotNetNuke is available from DotNetNuke Corporation.
 


  Ads  
WebHostForAsp.net
 


  Sponsors  

Meet Our Sponsors

.: CounterSoft :.
telerik
ExactTarget email software solutions
Merak Mail Server
WebSecureStores -- ASP.NET & DotNetNuke Hosting Solutions
FCKeditor Project
 


DotNetNuke Forums
 
  Forum  DotNetNuke® Pro...  Reports Module ...  SUSER_SNAME() used in Report Module doesn't get NT ID -- Help!
Previous Previous
 
Next Next
New Post 6/11/2008 12:28 PM
Unresolved
User is offline uccan
11 posts
10th Ranked


SUSER_SNAME() used in Report Module doesn't get NT ID -- Help! 
I am creating a report and uses SUSER_SNAME() function to get NT user ID. The purpose of the report is for intranet user to view their report. I tested in Visual Studio SQL environment and I get the correct Windows Authenticate user ID. Then I pasted the SQL syntax into Reports Module but I got “admin” ID. Anyone can solve the problem?
 
Thanks in advance
 
New Post 6/11/2008 3:51 PM
User is offline Andrew Nurse
353 posts
8th Ranked






Re: SUSER_SNAME() used in Report Module doesn't get NT ID -- Help! 

All DotNetNuke modules connect to the SQL Server using the same user (as configured in the web.config). If your web.config file specifies Integrated Security, it is the user under which ASP.Net is running (usually "NT AUTHORITY\NETWORK SERVICE"), not the current DNN user, that will be authenticated with SQL Server.


Andrew Nurse
DotNetNuke Core Team Member and Reports Module Project Lead
Microsoft Certified Professional Developer

 
New Post 6/12/2008 8:10 AM
User is offline uccan
11 posts
10th Ranked


Re: SUSER_SNAME() used in Report Module doesn't get NT ID -- Help! 

 Andrew Nurse wrote

All DotNetNuke modules connect to the SQL Server using the same user (as configured in the web.config). If your web.config file specifies Integrated Security, it is the user under which ASP.Net is running (usually "NT AUTHORITY\NETWORK SERVICE"), not the current DNN user, that will be authenticated with SQL Server.

Got it!  And thanks very much Andrew for your quick reply.
 
So, is any way in the Report Module I can get current user's Windows Authentication ID from SQL database or SQL syntax? I am using Authentication Providers Module. I am thinking how I can get current user ID from database? Any advice?
 
Many thanks.
 
New Post 6/12/2008 9:08 AM
User is offline Andrew Nurse
353 posts
8th Ranked






Re: SUSER_SNAME() used in Report Module doesn't get NT ID -- Help! 

You can access the current DNN user's ID by using the @UserID parameter in your SQL Query. I'm not exactly sure how the Windows Authentication Provider works, but I believe that the username in the Users table for that user is the same as their Windows user name, so the following query should work (or at least point you in the right direction).

SELECT Username FROM {oQ}Users WHERE UserID=@UserID


Andrew Nurse
DotNetNuke Core Team Member and Reports Module Project Lead
Microsoft Certified Professional Developer

 
New Post 6/12/2008 9:52 AM
User is offline uccan
11 posts
10th Ranked


Re: SUSER_SNAME() used in Report Module doesn't get NT ID -- Help! 

 Andrew Nurse wrote

You can access the current DNN user's ID by using the @UserID parameter in your SQL Query. I'm not exactly sure how the Windows Authentication Provider works, but I believe that the username in the Users table for that user is the same as their Windows user name, so the following query should work (or at least point you in the right direction).

SELECT Username FROM {oQ}Users WHERE UserID=@UserID

It worked!!
I am using Survey Module and would like to Create a report that can be viewed by users. Here is the SQL syntax that I would like to share with others. it maybe useful for someone else.

SELECT DISTINCT Users.DisplayName, Surveys.ViewOrder, Surveys.Question, SurveyOptions.OptionName
FROM         Surveys INNER JOIN
                      SurveyOptions ON Surveys.SurveyID = SurveyOptions.SurveyID INNER JOIN
                      SurveyResults ON SurveyOptions.SurveyOptionID = SurveyResults.SurveyOptionID INNER JOIN
                      Users ON SurveyResults.UserID = Users.UserID INNER JOIN
                      UserProfile ON Users.UserID = UserProfile.UserID
WHERE     (UserProfile.PropertyDefinitionID = 45) AND (NOT (Surveys.ViewOrder IN (1, 9))) AND (Users.UserID IN
                          (SELECT DISTINCT @UserID
                            FROM  Users ))

Many thanks again.

 
Previous Previous
 
Next Next
  Forum  DotNetNuke® Pro...  Reports Module ...  SUSER_SNAME() used in Report Module doesn't get NT ID -- Help!
 


Forum Policy

These Discussion Forums are dedicated to the discussion of the DotNetNuke Web Application Framework.

For the benefit of the community and to protect the integrity of the project, 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 DotNetNuke.
2. Discussion or promotion of DotNetNuke product releases under a different brand name are strictly prohibited.
3. No Flaming or Trolling.
4. No Profanity, Racism, or Prejudice.
5. Site Moderators have the final word on approving/removing a thread or post or comment.
6. English language posting only, please.

 


Disgrafic
Diseño y creación de portales web dinámicos :: Desarrollo de módulos personalizados :: Soluciones a medida :: Imagen Corporativa :: Tu proveedor DNN en España
www.disgrafic.com
DM Analytics, LLC
DM Analytics, LLC provides software solutions that facilitate rapid development of independent or dependent datamarts and their associated web-based reporting.
www.dmanalytics.com
Integral Hosting | DNN only $14.95/month
Experienced .NET hosting on Windows 2003, ASP.NET 1.1 & 2.0, MSSQL with real technical support.
www.integralhosting.com

DotNetNuke Corporation   Terms Of Use  Privacy Statement
DotNetNuke®, DNN®, and the DotNetNuke logo are trademarks of DotNetNuke Corporation
Hosted by MaximumASP