Getting Client username in VB.Net - asp.net

I am trying to get the client domain\username from a VB.Net application.
When I use
System.Security.Principal.WindowsIdentity.GetCurrent().Name
I get the results I want. But only when running it locally through visual studio / iisexpress
But When I try to put it on my IIS 7.5 (on windows 2008 server), the program will stop when it gets to running this line of code. It just stops.
using this
on Error GoTo test_Error
test_Error:
Error_Handler(writes errors to a sql log)
The error is not caught.
So what is going on?
Thanks!
UPDATE:
Using the 'Try-catch' here
Try
MsgBox(System.Security.Principal.WindowsIdentity.GetCurrent().Name)
Catch ex As Exception
MsgBox(ex.Message)
End Try
and still cannot get an error message to show (Chrome broswer, yes popups are enabled)
Using chrome developer tools I found this was the error:
Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 500

Try this -
Request.ServerVariables("AUTH_USER")
This will return raw authenticated username.

Related

R shiny publish issue Unhandled Exception: HTTP 500: Internal Server Error

I was trying to publish my shiny app, it works fine in local, but when I try to publish it, i got this error:
Unhandled Exception: HTTP 500: Internal Server Error
What does this mean?
Don't know which part goes wrong, hope someone can help.
Same here, looks like they are having server issues...
HTTP 500 refers to an issue with the web server (service), don't worry it's not a problem on your end.
See: http://www.checkupdown.com/status/E500.html
You can periodically try to publish again until it works. You can also check the Shiny Google Discussion Group https://groups.google.com/forum/#!forum/shiny-discuss for shinyapps.io

SignalR negotiate fails (Bad Gateway)

Someone any idea, I’ve been struggling with this for some time.
I'm using SignalR (Asp.net 5). when I try to debug local (ISS 10.0 express) everything is working fine. SignalR is working (Long poll).
Now when I publish the app to Azure it I can access : .azurewebsites.net/signalr/hubs
but I cannot access .azurewebsites.net/signalr/hubs/negotiate
it returns:
The specified CGI application encountered an error and the server terminated the process.
When my web app calls $.connection.hub.start() it will fail.
GET XHR http://xxxx.azurewebsites.net/signalr/negotiate [HTTP/1.1 502 Bad Gateway]
I’m running out of idea's. Don't know how I can get more debug information.
Small selection of my ‘already tried’ list:
Set $.connection.hub.url path manual to http://xxxx.azurewebsites.net/signalr/
Enable/Disable websockets
Removed forwardWindowsAuthToken from the web.config httpPlatform
EDIT:
Now getting more details on this error:
CryptographicException: The data protection operation was unsuccessful. This may have been caused by not having the user profile loaded for the current thread's user context, which may be the case when the thread is impersonating.
Still absolutely no idea how to solve this!
Solved by using appBuilder.UseAesDataProtectorProvider();
(from Owin.Security.AesDataProtectorProvider;)
I have no idea if this is the best solution.

Detailed error messages ASP - Showing 2 lines

I am trying to debug an ASP Intranet application,
I have turned on detailed error messages and turned off Friendly error messages in IE but my error message only shows:
error '80004005'
/login.asp, line 15
If I debug an asp.net application I get a block of information including where the error occurred for example, "MySQL Failed to connect...
Is there any way to show more detailed error messages,
I have ran through Detailed 500 error message, ASP + IIS 7.5
But I still only get the basic error message which shows me there is a connection issue 'Somewhere'
Error '80004005' means that a database connection failed. Is your connection string correct, is your database running, (or if you're using Access, does your IUSR account have the correct permissions on the mdb file)?
(Comment posted as question as suggested)

the request failed with http status 401 unauthorized ssrs

I am developing a web application using Asp.net & c#. To generate a reports i am using SQL Server Business Intelligence Development Studio(ssrs).I get a error like "the request failed with http status 401 unauthorized" please help me
thanks in advance
The actual error is as follows
ex = {"The request failed with HTTP status 401: Unauthorized."}
{System.Net.WebException: The request failed with HTTP status 401: Unauthorized.
at Microsoft.Reporting.WebForms.Internal.Soap.ReportingServices2005.Execution.RSExecutionConnection.GetSecureMethods()
at Microsoft.Reporting.WebForms.Internal.Soap.ReportingServices2005.Execution.RSExecutionConnection.IsSecureMethod(String methodname)
at Microsoft.Reporting.WebForms.Internal.Soap.ReportingServices2005.Execution.RSExecutionConnection.SetConnectionSSLForMethod(String methodname)
at Microsoft.Reporting.WebForms.Internal.Soap.ReportingServices2005.Execution.RSExecutionConnection.ProxyMethodInvocation.Execute[TReturn](RSExecutionConnection connection, ProxyMethod1 initialMethod, ProxyMethod1 retryMethod)
at Microsoft.Reporting.WebForms.Internal.Soap.ReportingServices2005.Execution.RSExecutionConnection.LoadReport(String Report, String HistoryID)
at Microsoft.Reporting.WebForms.ServerReport.EnsureExecutionSession()
at Microsoft.Reporting.WebForms.ServerReport.SetParameters(IEnumerable`1 parameters)
at Microsoft.Reporting.WebForms.Report.SetParameters(ReportParameter parameter)
at Reports_CustomerWtrEff.GetReports(String SampleCodes, String lstSampleCode) in CustomerWtrEff.aspx.cs:line 98}
Check out this link below, as it could lend an answer to your problem.
REF: http://www.taznetworks.com/rss/2006/03/crm-30-sbe-sql-reporting-error.html
EDIT:
In doing some work with CRM recently on some test installs we kept coming up with the error that "Setup failed to validate specified Reporting Services Report Server https://server.xxx.com/ReportServer. Error: The request failed with HTTP status 401: Unauthorized.
This seems to be a pretty common problem out there but not a lot of response to the issues. One thing I can say is that CRM is a good product but man is it complex in the guts of it. Not for the faint of heart that's for sure, especially when it comes to SQL and SQL reporting services.
Anyway back to the problem. In most cases with CRM 3 and SBS the documentation at such sites as Anne Stanton's show a problem with ISA. This box we were building didn't have ISA (as of yet).
The problem we were experiencing seems to be more with SP1 of Windows Server 2003 than anything else. The KB article 896861 seems to be spot on. We did the following according to the article:
Click Start, click Run, type regedit, and then click OK.
In Registry Editor, locate and then click the following registry key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa
Right-click Lsa, point to New, and then click DWORD Value.
Type DisableLoopbackCheck, and then press ENTER.
Right-click DisableLoopbackCheck, and then click Modify.
In the Value data box, type 1, and then click OK.
Quit Registry Editor, and then restart your computer.
Doing this allowed us to get to https://servername/reports and show the full SQL Reporting Services web site. CRM Reports now work as they were meant to.
I faced this issue and tried more and more and finally found that
open the reporting service configuration and connect to server then open web service url you will find the url copy it (URL)
open your SQL server data tools project and in the project properties
target server URL is the mentioned URL in the reporting service configuration and target report folder is the name of the project
in your asp.net project you will write the following code:
.
ReportViewer1.ProcessingMode =
Microsoft.Reporting.WebForms.ProcessingMode.Remote;
ReportViewer1.ServerReport.ReportServerUrl = new Uri(**URL**);
ReportViewer1.ServerReport.ReportPath = String.Concat(**target report folder**, "name of the report ");
ReportViewer1.ServerReport.Refresh();

IIS7 won't display ASP.Net error message or stack trace

I'm trying to debug an error in an ASP.Net 3.5 application. We recently moved the application from IIS6 to 7. In IIS6, code like this:
Throw new Exception("My message")
Would display a page giving the error message, nearby lines of code, and a stack trace (using "debug" compilation mode and no custom errors).
In IIS7, the "detailed" error message gives only the module and error code:
HTTP Error 500.0 - Internal Server Error
The page cannot be displayed because an internal server error has occurred.
Detailed Error Information
Module global.asax
Notification BeginRequest
Handler StaticFile
Error Code 0x00000000
Requested URL [My URL]
Physical Path [My Path]
Logon Method Not yet determined
Logon User Not yet determined
Failed Request Tracing Log Directory [My Directory]
I even set up Failed Request Tracing, which purports to give a stack trace but which still doesn't give me any line numbers or error messages, only the module name and HTTP status.
No. 111.
Severity Warning
Event -MODULE_SET_RESPONSE_ERROR_STATUS
ModuleName global.asax
Notification 1
HttpStatus 500
HttpReason Internal Server Error
HttpSubStatus 0
ErrorCode 0
ConfigExceptionInfo
Notification BEGIN_REQUEST
ErrorCode The operation completed successfully. (0x0)
How can I get the information I was getting in IIS6? I already know the error is in global.asax, I need a line number and a specific error message.
Also, I'm not sure if this is related but the site is precompiled and aspnet_compiler.exe apparently sets the web.config "debug" switch to false when it compiles (even with the "-d" option). My machine.config has no "deployment" tag. I just set "debug" back to true and recycle after compiling, which I assume would put the site back in debug mode, right?
There is a setting in the error page config that tells IIS the level of detail information to show for local and remote requests. You might want to verify this is configured correctly. To access this setting launch the Internet Information Services Manager and go to
Site Home\Error Pages\Edit Feature Settings
Make sure you disable this setting in production

Resources