This project was previously working on the server, with the code on the mainpage the same as mainpage i'm running now, except for another if statement. (which works ok on my local pc).
Thanks for any help offered
The following error message is displayed:
Server Error in '/TestReportPage' Application.
Index was outside the bounds of the array.
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.IndexOutOfRangeException: Index was outside the bounds of the array.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. |
Stack Trace:
|
Here is the code on the page that uses an array,
** denotes line 66 where the problem seems to come from.
What I dont understand however is why it works on the localhost and not on the server, and the same code has previously worked on the server.
Thanks Aidy...
PrivateSub Page_Load(ByVal senderAs System.Object,ByVal eAs System.EventArgs)HandlesMyBase.Load
thismth = DatePart(DateInterval.Month, dtoday)
Session("Mth") = thismth - 1
'Get the username of the user logged onto the website
Dim arrSomething, strNTUser, strNTDomain
arrSomething = Split(User.Identity.Name, "\")
Dim sUNameAsString
sUName = arrSomething(1)**
sUName = sUName.ToUpper
lblRole.InnerHtml = sUName
Session("UName") = sUName
...
The username is coming back blank so your array has no elements in it. You need to enable windows authentication and disable anonymous browsing. That will make the identity come back as
domain\user
like you are expecting.
Thanks a million, that did the trick!![]()
0 comments:
Post a Comment