Windows Server - Problem acessing TS

Asked By Dom Afonso on 25-Jun-12 02:25 PM
Earn up to 30 extra points for answering this tough question.
I installed Terminal Server on Windows Server 2008 Standard and when I run it in the browser, I get the following error:

Object reference not set to an instance of an object.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

Line 18: 
Line 19:         System.Security.Principal.WindowsPrincipal wUser = User as System.Security.Principal.WindowsPrincipal;
Line 20:         if (wUser.IsInRole(System.Security.Principal.WindowsBuiltInRole.Administrator) || User.IsInRole("TS Web Access Administrators"))
Line 21:             fUserAdmin = true;
Line 22:         else

Source File: c:\Windows\Web\ts\en-US\Default.aspx Line: 20

Stack Trace:

[NullReferenceException: Object reference not set to an instance of an object.]
   ASP.en_us_default_aspx.Page_Init(Object sender, EventArgs e) in c:\Windows\Web\ts\en-US\Default.aspx:20
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +24
   System.Web.UI.Page.OnInit(EventArgs e) +104
   System.Web.UI.Control.InitRecursive(Control namingContainer) +132
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1969

Do anyone know how to solve this?
Robbe Morris replied to Dom Afonso on 25-Jun-12 02:29 PM
I see an IF statement comparing wUser and User.  Are these the same object?
Peter Bromberg replied to Dom Afonso on 25-Jun-12 09:42 PM
You need to put a breakpoint on line 20 and mouse over your wUser etc. variables to see which one is null. What kind of IIS authentication do you have set for this web application? You need to uncheck anonymous and choose Windows if you expect to get any Windows users.
Jitendra Faye replied to Dom Afonso on 26-Jun-12 12:29 AM
This problem comes when you try to get or set values from any  null object.

so before fetching or setting value first check that is it null or what.

check for object where you are getting error.



In your code check for this line-

System.Security.Principal.WindowsPrincipal wUser = User as System.Security.Principal.WindowsPrincipal;

First check -
wUser  is null or what , if it is null then you will get this error.
help
Our old Windows Server 2003 terminal server is at end of life. It was also our Terminal Server License server. We installed a new Windows Server 2003 terminal server, and configured a
Hi, I have a question about terminal server license. I did install the terminal server, terminal server license then activate in our windows server 2003 enterprise. Our license is per user
We have Terminal Servers running Windows Server 2003. The server was setup as the Terminal Server licensing server (Server 1). Within the Terminal Server X licensing window it lists three (3
How would you go about setting up one terminal server so terminal server users with roaming profiles use a local profile on justn that one terminal server
Hello there! Restore previous versions is not working on Windows Server Terminal Server. The situation: We have a file server, a terminal server and a backup server. All are running Windows Server 2008. All data files are
Hi All Just wondering which server I should install the Terminal Server Licensing Role. . . We have just installed SBS 2008 Premium. . . . We currently have three Servers - SBS Server, 2nd Server has SQL and we had an existing Terminal Server (server 2003) in place
Hello, Is it not recommended that the terminal server will be the file server? Regards, Windows Terminal Services Discussions Windows Server (1) Report (1) XenAppp (1) Directory (1) Hospice (1) Constrains (1
Hi, Have an SBS 2008 domain currently running two Windows Server 2003 Terminal Servers. We're now planning on adding an additional Windows Server 2008 Terminal Server. Terminal Server Licensing role is already currently installed on the SBS 2008 box. What's
I have Terminal Server Licensing installed on a W2K3 Terminal Server. The server is being replaced, how do I move the License server to another server