How can I find the client machine name in classic ASP? - asp-classic

I know how to get the IP address but is there a way for me to get the client machine name?
addr = request.servervariables("REMOTE_ADDR")

You can't. HTTP does not transmit that information. A Windows network does, which is not HTTP.

The only method that has worked for me is to have some local VBScript send back the information - which will only work in IE.
Because I'm working on a corporate intranet where I know everyone is using IE, it was a workable solution. I did eventually migrate some of the code (notably sending back the machine name) to a deployed HTA (HTML Application) in a recent update. Since HTA's only work on Windows, and always use the IE rendering engine, it removed some of the concerns we had with people potentially accessign it on non-IE browsers.
Inside a text file with a .hta extension, we have the following which sends back to the server the machine name:
<HTML>
<HEAD>
<TITLE>Full Name of App</TITLE>
<HTA:APPLICATION ID="AppID" APPLICATIONNAME="AppID" SHOWINTASKBAR="yes"
SINGLEINSTANCE = "yes" WINDOWSTATE="maximize" ICON="http://example.com/favicon.ico">
<STYLE TYPE="text/css">
html, body {margin:0px;padding:0px;}
iframe {margin:0px;}
</STYLE>
</HEAD>
<BODY scroll="no">
<script type="text/vbscript">
Set objNet = CreateObject("WScript.NetWork")
document.write("<iframe id=""frmClient"" trusted=""yes"" src=""http://example.com/projects/projectname/default.asp?Workstation=" & objNet.ComputerName & """ WIDTH=""100%"" HEIGHT=""100%""></IFRAME>")
Set objNet = Nothing
</script>
</BODY>
</HTML>
Obviously this may not work for you depending on what you may or may not be able to use - I figured I'd post this in case it's helpful for someone with similar constraints to my usage.

Related

Server side Rendering shows output as HTML string rather properly formatted HTML

My site is using Angular 10 (With server side rendering). I referred to https://angular.io/guide/universal to convert the site into SSR. Everything is working fine. 'View Source' shows me the content, I can share with Social Media. My node server does not give me any error.
The only issue I am facing is - When it is rendered through the node server, it shows as HTML string. For few seconds user sees below:
<!DOCTYPE html> <html> <head> </head> <body> <h3>Step 1 - Add environment variable </h3> <p> ......</p> </body> </html>
Later it switches back to properly formatted HTML. The same is the case with material icons used on site. I see them as strings initially.
Please check out the link https://ecokrypt.com/dashboard/article/detail/5e59df2b00190207e65d9e99/4.3---Angular%253A-Consider-Different-Environments
Slow network throttling shows the issue clearly. This is giving a very bad end-user experience. Am I missing any step in SSR? How can I handle this? I tried to search this issue on google, but no luck.

When using Referrer-Header: no-referrer, how to resolve relative URL's from within nested pages?

Let's say I've got a page at www.example.com/pages/page.html and page.html has relative script/link url's. The way I would normally know to serve /pages/js/page_js.js or /pages/css/page_css.css is to check the "referrer" header to see that it was http://www.example.com/pages. Otherwise my relative script which looks like: <script src="js/page_js.js"></script> would actually resolve to /js/page_js.js on my server.
Referring to the documentation of helmet.js there's a security recommendation which involves blocking the browser from sending the referrer header. If I were to implement this, well then how could I resolve the assets without knowing which path to resolve them to?
If example.com/pages/page.html looks like this:
<!doctype html>
<html>
<body>
<script src="js/a.js"></script>
<script src="/js/b.js"></script>
</body>
</html>
The browser knows how to turn this into two requests: one to example.com/pages/js/a.js and the other to example.com/js/b.js. The Referer header isn't too relevant in this case.
(PS: I maintain Helmet, so if any of that documentation is unclear, let me know!)

Does WebMango support uploading DICOM images?

I am confused about uploading new DICOM images to webMango. I was able to do it in the desktop version, but I am unable to do it in webMango? Is it possible using WebMango to view a DICOM image? OR not?
Is it always that I have to provide the params ?
Kindly advice.
Thank you
Yes, you can view DICOM images in webMango. You configure it similar to Papaya, except that you need to put double-quotes around the parameter values. (Also note the images array contains another array of DICOM series URLs.) Here's an example:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>webMango</title>
<script src="mango.js"></script>
<script src="https://www.java.com/js/deployJava.js"></script>
<script>
var params = [];
params["images"] = "[['data/volume/brain_001.dcm', 'data/volume/brain_002.dcm', 'data/volume/brain_003.dcm']]";
params["atlas"] = "data/Talairach.xml";
</script>
</head>
<body>
<p>This is an example use of webMango.</p>
<div style="width:800px;" class="mango"></div>
</body>
</html>
webMango cannot see the local filesystem. So you can only load files via URL references in the params variable. I think it would be technically possible to allow it to see the local filesystem (at least on some platforms), but browsers have been dropping support for Java applets in recent years, putting up more and more hurdles. I'd recommend Papaya over webMango in most cases.

IE bug Invalid Source HTML5 audio - workaround

I (and about a million others) have found a bug in IE11 (not sure if other versions have the same bug) where, if you create an HTML5 audio tag, the browser reports "Invalid Source" no matter what. I've tried every combination I can think of with no luck. So far:
Changing the HTML end tags from self-closing to explicit
Changing the file name to eliminate any odd characters
Changing the audio sub format to every possible setting
Adding an explicit URI ("http:// ...")
Disabling all plugins (there were on the stock plugins)
Trying every possible audio format
Defining the MIME type
Changing the audio tag's parameters.
Changed the IIS settings to include the MIME types.
I have checked Microsoft's "Connect" website. They make the claim that it is not reproducible, but hundreds of thousands of Google results suggest otherwise.
Is this not possible at all? ALL other latest & greatest browsers I tried work (Firefox, Opera, Safari, Chrome). No solutions work.
Here's the code:
<%# Page Language="VB" AutoEventWireup="false" CodeFile="AudioPopupPlayer.aspx.vb" Inherits="AudioPopupPlayer" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<div style="padding-top: 30px; margin: auto; width: 300px;">
<asp:Literal ID="litVoiceOver" runat="server"></asp:Literal></div>
</body>
</html>
Code behind:
Partial Class AudioPopupPlayer
Inherits System.Web.UI.Page
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
Dim VoiceOverFileName As String = Request.QueryString("vo")
If VoiceOverFileName.Length > 0 Then
Dim root As String = HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Authority) + ResolveUrl("~/")
Dim audiosource As String = "<audio id=""VoiceOver"" autoplay=""autoplay"" preload=""preload"" controls=""controls""><source src=""" & root & "audio/" & VoiceOverFileName & ".ogg"" type=""audio/ogg"" ></source><source src=""" & root & "audio/" & VoiceOverFileName & ".mp3"" type=""audio/mpeg"" ></source><source src=""" & root & "audio/" & VoiceOverFileName & ".wav"" type=""audio/wav"" ></source></audio>"
Me.litVoiceOver.Text = audiosource
End If
End Sub
End Class
And, finally, a screenshot (in IE11) showing that the HTML is rendered perfectly, yet I still get the dreaded "Invalid Source" message (NOTE: copying and pasting the link causes the audio file to play - go figure).
I had the same issue trying to use the simple HTML5 code. The url and file name were correct as well. This is what worked for me:
<audio src="song.mp3" controls autoplay></audio>
You can remove the controls if you don't need them, it's still going to work. I hope this helps!
I tried a couple of new file formats.
Internet Explorer 11 only supports the M4A audio format (WAV, OGG & MP3 are not supported).
Microsoft really needs to put the correct information on their website about what their browser supports (they claim MP3 is supported, but clearly, it is not).
Madness, I tell you!
We have experienced the same issue in a corporate environment with fresh installs of IE11 and Windows 7.
We have resolved the issue by installing the K-Lite media pack and have an alternate MP3 codec installed. Then it worked.
A comment from here:
Posted by Jonathan Laughery on 23.5.2014 at 22:19
This is because IE's HTML5 audio tag doesn't support WAV PCM format. This is especially weird because IE does support WAV PCM in the deprecated bgsound tag, WAV PCM has been the native Microsoft Windows audio format forever, and Microsoft's is the only major browser that doesn't support it. WAVs are still popular in sound archives and used on corporate networks, but playing WAVs in IE requires the bgsound tag (IE-specific, deprecated, and poor control), transcoding on the server, or using a flash player (like jPlayer's fallback) which is what the HTML5 audio tag was designed to avoid. Please add this format.
Here's the documentation about bgsound . If you going to use bgsound this might be helpful
Check the browser's response headers for the audio file response. I ran into this issue due to a server not being configured to send the audio file as an audio/mpeg. Someone had mp3s set to application/octet-stream in IE. Once I fixed this, everything worked fine.

Local website renders differently using (IP address or machine name) vs localhost?

I have an MVC3 (razor) site published to IIS7 locally for testing purposes.
When I access the site via "localhost" it looks different from when I access using the IP address or machinename?
I have cleared my cache and re-loaded the pages to confirm and they still appear the different. The CSS must be loading to give the correct fonts/colours etc, although ":hover" elements appear to load much slower?
I am using JQuery/JQueryUI on the site if that helps identify the problem?
Any ideas?
Edit: More info
The titles, labels and table definition are build from ViewBag.Title, or looping through rows in a ViewModel - nothing clever, just standard MVC3/Razor stuff.
The same css file is used for every page, and F12 in IE8 shows the correct css has been loaded.
Title/subtitle font sizes/colours are correct, just their positioning is out?
Table border appears thicker?
Positioning generally seems a little "out", but I can't understand why there is this difference?
Can a firewall/AV package strip out positioning?
The same css file is used for every page, and F12 in IE8 shows the
correct css has been loaded.
Developer Tools should show that IE is not using the same "Browser Mode"/"Document Mode" between the two instances of the site, because that's the problem here. IE defaults to different modes depending on if you're using a machine name or not (amongst other things).
Adding this to your <head> should sort out the problem:
<meta http-equiv="X-UA-Compatible" content="IE=edge">
I had a similar issue, where the sizes differed from the local development site to the one on the production server. Turned out that I forgot the zoom level to 90% when viewing the development version... This answer helped me realize that: https://superuser.com/questions/315448/different-font-size-between-localhost-and-remote-server-in-firefox
I had exactly similar issue in IE11, I used this code
<meta http-equiv="X-UA-Compatible" content="IE=11">
And now whether its localhost or my machine name, the page always rendered nicely.
Just wanted to add, that if you use HTML5 tags (nav, header etc.) IE8 will render different on localhost and remote host.
If you add:
<!--[if lt IE 9]>
<script>
document.createElement('header');
document.createElement('nav');
</script>
<![endif]-->
Then the IE8 will show the same on local and remote host.

Resources