(ASP.NET 2008) opens the file within browser rather than showing a Open/SaveAs dialog - asp.net-3.5

we have image files in IIS6.0 server, and wanted to open in browser using ASP.NET2008.
My problem is that it always shows the open/saveas dialog, but what I wanted is, it should open the file in the browser directly. we are using ASP.NET2008. It would be great if you provide the sample code.
thanks

You could try to embed those file(s) into a simple HTML page. This will make browsers display it without prompting the user.
Making your code output bare bones like:
<html>
<head><title>YOUR_IMAGE_NAME</title></head>
<body>
<img src = 'YOUR_IMAGE' alt='YOUR IMAGE DESC' />
</body>
</html>
to the browser should be sufficent.
HTH

Related

How to run Auto Hot Key file from web Page?

Is there any way to call or run .ahk files from web page using any of (HTML - JS - PHP)?
I need to start ahk files from my web pages on link or button clicks
Here is an example of how it can be done by using some evil activeX.
It used to be possible to access a users whole computer using activeX in the Internet Explorer. Nowadays ActiveX is mostly disabled. But we can still create .hta files to render html etc and these files allow the usage of activeX.
Try to save this as something.hta
<!DOCTYPE html>
<head>
<meta http-equiv='X-UA-Compatible' content='IE=9'>
<script language="JScript">window.resizeTo(200,100);</script>
<script language="JScript">
function runAhkScript() {
var ahkExePath = "C:/Program Files/AutoHotkey/AutoHotkey.exe";
var scriptToExecute = "C:/aaa/a.ahk";
new ActiveXObject("Shell.Application").ShellExecute(ahkExePath, scriptToExecute)
}
</script>
</head>
<body>
Run the autohotkey script
</body>
Adjust the path to your autohotkey.exe and your script and make sure you use forward slashes in the pathes.
You can not do that while accessing your web pages over a remote server (even localhost). If you access your web page on your local machine (i.e., typing "file:///C:/path/my web page.html" in the browser), and you use Internet Explorer as your browser, you might try:
<button onclick="window.open('file:///C:/path/my ahk script.ahk')">
Launch My AHK Script
</button>
Or, you may have to try it this way:
<button onclick="Process.Start('C:\path\my ahk script.ahk')">
Launch My AHK Script
</button>
(But maybe switch the slashes to "/" or add "file:\\" (trying with two or three slashes, and in each direction).
Hth,

Facebook Page Tab external URL

What should contain a HTML file to display it on a Facebook Page's Tab. I have added the tab, but I get blank page, I have tried everything, searched hours, my URL is HTTPS, so I really don't know...
Could you paste anybody a full HTML code that works, appears in a Page's Tab with an app? Thanks!
That would be the minimum, it definitely works:
<!DOCTYPE html>
<html>
<head>
</head>
<body>
hello there
</body>
</html>
As you can see, nothing fancy there. Without any test URL, we can only tell you to open the browser console and search for errors.
We found the answer, the server doesn't enable the iframing, so what I tried was good, but
Console's JavaScript error: Load denied by X-Frame-Options: https://www.... does not permit cross-origin framing.
So we contacted to our hosting company to solve this.
UPDATE: Hosting support added the following code to my .htaccess file: Header always unset X-Frame-Options, what solved my problem.

using .php with .css or some thing better?

I have a log in page for my web site. The log in file is "index.php" this will be the first page you come to when comming to my site. The rest of my site is HTML with a style.css file providing the look for my site. Now my questions is how do I get my index.php file too look like the rest of my web site?
Right now when you come to mydomain.com/index.php it is just a white page with a log in and password box. I would like my log in page to look like the rest of my web site. Can some one please refer me as how to do this?
I have other .php files that would also need to be linked with the .css such as register.php and so forth. thanks guys.
If there is a different/better method of doing what I need please feel free to chime in, I'm all ears at this point I've been trying to do this for 2 days.
Like you would do in every other html page you will have to link the file the same way.
I guess that you have already seen that in every php file there is html code?
Just stay out of the php brackets
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="styles.css">
</head>
<body
<?php
"php code in here"
?>
</body>
</html>
If you don't find the usual html markup somewhere search for a include function in the php file.
Maybe the html header is in other php file and it is being called from there.
They would be included like this
include '_header.php';
You can use the CSS file, similar to how you use it in your HTML files. You can either post the CSS tag below your PHP code, or you can use an echo "cssTagHere"; call within your PHP code.
If you're using a login page, though, are you maintaining that security with the rest of your site by using PHP on your other pages?

Link within email that opens a dialog

Ok, I have a client with a peculiar request. He wants to receive an (generated by a workflow) email with a hyperlink that will open a pop-up dialog if you click on it. Note: the link within the email should open a popup and not a web page in a browser.
I immediately thought this would be impossible, but after looking around a bit I found out that you can create a workflow variable with tags in them and insert them into the email body.
eg: here
The conclusion that I draw from this is that an email consists of html code that the email client renders. Now I'm wondering if there is a way to make use of a tag no cause a modal dialog to pop up?
I guess the question is what functionality the email client (Microsoft Outlook) supports. I can't figure how to attach some JavaScript or something that will be used by Outlook. Is there perhaps some embedded functionality within Outlook to accomplish this?
That is very easy. Use this sample code and understand how it works with just normal "mailto" function:
<!DOCTYPE html>
<html>
<body>
<p>
This is an email link:
<a href="mailto:someone#example.com?Subject=Hello%20again">
Send Mail</a>
</p>
<p>
</p>
</body>
</html>
use
window.open('example.html',400,600) ​;
in your HTML code..
Also Refer this link for the answer of your question
http://www.coderanch.com/t/121512/HTML-CSS-JavaScript/Opening-popup-JS-outlook-mails

Iframe Size problem in facebook iframe application

I have an iframe application which works fine but the issue comes when the content of iframe is large the text appears to be cut down.
I registered the application as iframe and set as resizable.
I have applied the following code but nothing seems to work
<div id="FB_HiddenIFrameContainer" style="display:none; position:absolute; left:-100px; top:-100px; width:0px; height: 0px;"></div>
<script src="http://static.ak.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php" type="text/javascript"></script>
<script type="text/javascript">
FB_RequireFeatures(["CanvasUtil"], function(){
FB.XdComm.Server.init(xd_receiver.htm);
FB.CanvasClient.setSizeToContent();
});
</script>
I have xd_receiver.htm file in myapp folder.
Please help me on this
In my iframe app I use
FB.CanvasClient.startTimerToSizeToContent();
instead of setSizeToContent() which seems to work for me.
Edit:
Can your javascript actually see the xd_receiver.htm file? Does it need a path (absolute or relative?) Is Apache serving static files from that directory?
What browsers have you observed the problem in? Try running in firefox with firebug installed to debug javasript problems. I'm not sure if the code you posted is actually what you're using, but it seems to be missing quotes on the "xd_receiver.htm" and also, no api key.
Regarding the xd_receiver.htm--> If the path to your callback url is callback, it should exist at callback/xd_receiver.htm. You have specified a relative path, so if your canvas page lives at /foo/page.htm, then the receiver page should exist at /foo/xd_receiver.htm. You could also specify at absolute path like '/xd_receiver.htm' and just keep your xd_receiver at the root.
Your page should look something like this:
http://gist.github.com/156633