Hyperlink not operating correctly in ASPX file

J

JerryK

Hi,

I am trying to put a hyperlink to a .cer (certificate) file on a form.
Normally (on a ,htm page) when the user clicks on the hyperlink, the file is
not recognized and the user is given the option to save the file. This is
the desired result. However, when I put the hyperlink on a webform, the
file is opened and it's binary contents are displayed on the screen. Does
anyone know why this happens?

The hyperlink is as follows:

<a hreg="myfile.cer">Test Cert</a>

I also tried using Hyperlink web control and setting the
NavigateUrl="myfile.cer", but the results are the same.

Thanks,

jerry
 
C

Chris Dickens

I would assume the problem is MIME related. Check with Google and see what
kind of MIME type .CER files should be set to, or just set the server to
return "application/octet-stream" - that's sure to get a save box.

--Chris
 
J

JerryK

Thanks for the reply. I assumed it was MIME replated, but it is very strange
that it works from an HTML page but not from an ASPX page.

Just where does one set the return? This is a hyperlink control in the
middle of a dozen other controls on the form. Also, I do not see any
properties that effect the return when the user clicks a hyperlink control.

jerry
 
C

Chris Dickens

MIME types are normally configured in the IIS Manager by going to properties
on the web server machine and clicking the "MIME Types" button. If you do
not have admin rights to the web server (like if you're hosted) then you'll
have to call/e-mail your web host and have them add it for you.

I'm not sure why a browser would react differently if the link is on an HTM
vs an ASPX page - the web server returns the MIME type as a part of the
headers at the top of each response sent to the web browser and this
determines how the browser reacts, not the page before you click the link.
What browser is it?

--Chris
 
J

JerryK

I have control of the server so I can check out the IIS settings.

The browser is IE

It is not unique to this installion of IIS or IE also. I tried on
server/client combinations and the results are the same. Very strange.
Windows Server 2003 (my client) seems to know about the .CER extension. It
reports it as a Certificate file in File Explorer.


jerry
 
C

Chris Dickens

Yeah, the File Explorer behaviour is entirely different. I'm interested to
hear if setting a MIME type corrects your problem.

--Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top