HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 1.1ASP.Net 1.1Authentication UserID to valueAuthentication UserID to value
Previous
 
Next
New Post
9/18/2006 8:42 AM
 

You can also simply use:   UserInfo.UserID()

The answer to your 2nd question is Yes.  Here is a good way to find answers to your coding questions.

1.   Find a CORE page that is doing something similar to what you are looking for.
2.   Look at the code.

Contrary to what others may say, ALL the answers to nearly every question are in the existing code.

mikez

 
New Post
9/20/2006 7:13 PM
 

Ok, I'm going looney. I did what you suggested. I added the one line and then actually had to add another.

int intUserId;
intUserId = Dotnetnuke.Entities.Users.UserController.GetCurrentUserInfo.UserId;

Now I'm getting 2 silly errors. One is "The directive 'Page' is unknown." Which according to the pages I've been looking up say it has to do with a java thing but I'm not using any java. I've included it below. The other error I'm getting makes me want to pull out my hair. It says I'm missing a reference for DOTNETNUKE. ?!?!????? That's rediculous. I have it as a reference for the project. I have it listing in my usings. So I start going through code like crazy and trying wierd things. Basically what I'm getting right now is this.

'DotNetNuke.Entities.Users.UserController.GetCurrentUserInfo()' denotes a 'method' which is not valid in the given context

Is this a VB statement versus a C# statement? My whole app is in C# so if it's a VB statement I'm definately going to be having issues. BTW,This is the module page output.

An error has occurred.
DotNetNuke.Services.Exceptions.ModuleLoadException: Object reference not set to an instance of an object. ---> System.NullReferenceException: Object reference not set to an instance of an object. at System.Web.UI.UserControl.get_Request() at DotNetNuke.Entities.Modules.PortalModuleBase.get_IsEditable() at DotNetNuke.UI.Containers.Title.CanEditModule() at DotNetNuke.UI.Containers.Title.Page_Load(Object sender, EventArgs e) --- End of inner exception stack trace ---


Unhandled error loading module.
DotNetNuke.Services.Exceptions.ModuleLoadException: Parser Error: The directive 'Page' is unknown. ---> System.Web.HttpParseException: Parser Error: The directive 'Page' is unknown. ---> System.Web.HttpException: The directive 'Page' is unknown. at System.Web.UI.TemplateParser.ProcessDirective(String directiveName, IDictionary directive) at System.Web.UI.TemplateControlParser.ProcessDirective(String directiveName, IDictionary directive) at System.Web.UI.TemplateParser.ParseStringInternal(String text) at System.Web.UI.TemplateParser.ParseString(String text, String virtualPath, String basePhysicalDir) --- End of inner exception stack trace --- at System.Web.UI.TemplateParser.ParseString(String text, String virtualPath, String basePhysicalDir) at System.Web.UI.TemplateParser.ParseFile(String filename, String virtualPath) at System.Web.UI.TemplateParser.Parse() at System.Web.UI.TemplateParser.GetParserCacheItemThroughCompilation() at System.Web.UI.TemplateParser.GetParserCacheItemInternal(Boolean fCreateIfNotFound) at System.Web.UI.TemplateParser.GetParserCacheItemWithNewConfigPath() at System.Web.UI.TemplateParser.GetParserCacheItem() at System.Web.UI.TemplateControlParser.CompileAndGetParserCacheItem(String virtualPath, String inputFile, HttpContext context) at System.Web.UI.TemplateControlParser.GetCompiledType(String virtualPath, String inputFile, HttpContext context) at System.Web.UI.UserControlParser.GetCompiledUserControlType(String virtualPath, String inputFile, HttpContext context) at System.Web.UI.TemplateControl.LoadControl(String virtualPath) at DotNetNuke.UI.Skins.Skin.InjectModule(Control objPane, ModuleInfo objModule, PortalSettings PortalSettings) --- End of inner exception stack trace ---
 
New Post
9/20/2006 11:49 PM
 

Ok, I don't know how much head way I'm having but this is a little update. First, I've been constantly having the old can't copy dotnetnuke.dll in the VSWebCache. I ran through EVERY possible answer out there (been working that issue for weeks). Finally I just said, #$@(# it and opened up the Config Manager on the solution and unchecked the build box on every project but the ones I'm building. Simple reasoning, DNN works, I sure in the heck ain't changin' it so why keep building it much less cluttering up the results of what I want to see with DNN stuff. Kind of like setting my SQL registration not to show system tables and stuff. So with all that out of the way I was able to concetrate on the sill issue of the UserId. Just as a reminder I'm a Newbie. Yes I know lets all stop laughing now ;p I'm also working with a web app that is written in C#. Basically what I want to do is change all the aspx pages to ascx pages to make modules out of them and then strip out all the excess stuff but the relevent tables and buttons. I then need to make the existing app that uses the variable named intUserId get it's value from DNN's currently logged in user's User ID.  So after all the messing around I figured out 2 lines that would actually work without giving me some errors about method out of context or something like that. These are the 2 lines I added that I put in.

int UserID = Int32.Parse(DotNetNuke.Entities.Users.UserController.GetCurrentUserInfo().ToString());

int intUserId = UserID;

I've even tried many other types of combinations and get no joy. The wierd thing is I can no longer tell if I'm making any headway. Every time I check the module by looking at the browser I keep getting the same error and no new info. Any clue as to what I'm doing wrong.

An error has occurred.
DotNetNuke.Services.Exceptions.ModuleLoadException: Object reference not set to an instance of an object. ---> System.NullReferenceException: Object reference not set to an instance of an object. at System.Web.UI.UserControl.get_Request() at DotNetNuke.Entities.Modules.PortalModuleBase.get_IsEditable() at DotNetNuke.UI.Containers.Title.CanEditModule() at DotNetNuke.UI.Containers.Title.Page_Load(Object sender, EventArgs e) --- End of inner exception stack trace ---


Unhandled error loading module.
DotNetNuke.Services.Exceptions.ModuleLoadException: Parser Error: The directive 'Page' is unknown. ---> System.Web.HttpParseException: Parser Error: The directive 'Page' is unknown. ---> System.Web.HttpException: The directive 'Page' is unknown. at System.Web.UI.TemplateParser.ProcessDirective(String directiveName, IDictionary directive) at System.Web.UI.TemplateControlParser.ProcessDirective(String directiveName, IDictionary directive) at System.Web.UI.TemplateParser.ParseStringInternal(String text) at System.Web.UI.TemplateParser.ParseString(String text, String virtualPath, String basePhysicalDir) --- End of inner exception stack trace --- at System.Web.UI.TemplateParser.ParseString(String text, String virtualPath, String basePhysicalDir) at System.Web.UI.TemplateParser.ParseFile(String filename, String virtualPath) at System.Web.UI.TemplateParser.Parse() at System.Web.UI.TemplateParser.GetParserCacheItemThroughCompilation() at System.Web.UI.TemplateParser.GetParserCacheItemInternal(Boolean fCreateIfNotFound) at System.Web.UI.TemplateParser.GetParserCacheItemWithNewConfigPath() at System.Web.UI.TemplateParser.GetParserCacheItem() at System.Web.UI.TemplateControlParser.CompileAndGetParserCacheItem(String virtualPath, String inputFile, HttpContext context) at System.Web.UI.TemplateControlParser.GetCompiledType(String virtualPath, String inputFile, HttpContext context) at System.Web.UI.UserControlParser.GetCompiledUserControlType(String virtualPath, String inputFile, HttpContext context) at System.Web.UI.TemplateControl.LoadControl(String virtualPath) at DotNetNuke.UI.Skins.Skin.InjectModule(Control objPane, ModuleInfo objModule, PortalSettings PortalSettings) --- End of inner exception stack trace ---
 
New Post
9/8/2008 2:17 PM
 

Anthony Glenwright wrote

Just use:

  intUserId = Dotnetnuke.Entities.Users.UserController.GetCurrentUserInfo.UserId;

GetCurrentUserInfo is a shared (static) method, you don't need to create an instance of UserController to call it.

 

 

 

is there a way for me to use this to get a list of the roles that go with that UserId?

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 1.1ASP.Net 1.1Authentication UserID to valueAuthentication UserID to value


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.

Attend A Webinar
Free Demo Site
Download DotNetNuke Professional Edition Trial
Have Someone Contact Me
Have Someone Contact Me

Like Us on Facebook Join our Network on LinkedIn Follow DNN Corporate on Twitter Follow DNN on Twitter

Advertisers

DotNetNuke Scoop!

Sponsors

DotNetNuke Corporation

DotNetNuke Corp. is the steward of the DotNetNuke open source project, the most widely adopted Web Content Management Platform for building web sites and web applications on Microsoft. Organizations use DotNetNuke to quickly develop and deploy interactive and dynamic web sites, intranets, extranets and web applications. The DotNetNuke platform is available in a free Community and subscription-based Professional and Enterprise Editions with an Elite Support option. DotNetNuke Corp. also operates the DotNetNuke Store where users purchase third party apps for the platform.