Hi,

In my UserControls library, I noticed that when you click on a .ascx file,
you are usually prompted to either open or save the file, while occasionally,
the file is viewed in the browser itself. From my experimentation with issue,
any UserControl whose html code doesn't begin with a server control (except
for panels) will be viewed in the browser! To make sure, I simply inserted a
label control at the beginning, and now I am being promoted again!

Is there a way to enforce the prompt no matter what the content is, provided
the extension is not a browser-type (htm, html etc.)?

Thanks

--
I do it for a living, but you live with what I do.

RE: Inconsistent behavior when clicking on files in document library by v-wdxu

v-wdxu
Fri Sep 24 22:14:10 CDT 2004

------=_NextPart_0001_00FC7640
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Hi,

In fact, the ascx file is rendered by the aspnet isapi extension dll which
is located at %windir%\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll.
When we browse the ascx file directly, IIS will use this ISAPI extension to
render the file and produce the response to the client. Furthermore, when
IIS process the file, it will also need to check the MIME type to see how
it should treat this kind of file. However, by default, there is no mime
type for ascx in IIS6. So if you are going to view the ascx as the normal
html file, this will change the default behavior of ascx. I don't suggest
you do so, which may cause other ASP.net web applications fault. You will
take this as your own risk.

I introduce the detailed steps for you.
1. add the ascx MIME type in IIS
a. open the IIS mmc by typing the "inetmgr"(without the quotation mark) in
start -> run
b. right click your IIS node in the left tree of IIS mmc and click
Properties
c. in the property window, you will find the MIME type button, press it.
d. from the MIME type list, there is no ascx type. Click new button to
insert this list.
Extension: .ascx
MIME Type: text/html
e. ok to save this entry

2. remove the ASP.net ISAPI extension from your web applicaton folder.
a. right click your web applicaton located site node and click properties
b. choose the Home directory tab of the property window, please press
configuration... button
c. in the application extension list of configuartion window, locate the

RE: Inconsistent behavior when clicking on files in document libra by v-wdxu

v-wdxu
Sat Sep 25 04:20:59 CDT 2004

------=_NextPart_0001_024C3B48
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Hi,

Sicne ascx file extension is used for ASP.net built-in html component,
after the installation of ASP.net, this file extension is treated
differentlly as others. So far as I know, there is no way for us to make it
downloadable, which is also not encouraged by Microsoft to do so for this
kind of modification will affect the ASP.net web applicatoin behavior.

If you want to do so, you can develop one ISAPI filter to monitor the ascx
request. If one client request the ascx which means he is going to download
this file, you can read the ascx file from the server disk and then save it
as one temperary file as other file extension dll or exe etc. Then send the
temprory file url to the client for the download. After the download
completed, the client can only change the file extension to obtain the ascx
file.

Please feel free to let me know if you have any question.

Best Regards,
Wei-Dong Xu
Microsoft Product Support Services
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
------=_NextPart_0001_024C3B48
Content-Type: text/x-rtf
Content-Transfer-Encoding: 7bit

{\rtf1\ansi\ansicpg936\deff0\deflang1033\deflangfe2052{\fonttbl{\f0\fnil\fprq2\fcharset0 MS Sans Serif;}}
\viewkind4\uc1\pard\lang2052\f0\fs16 Hi,
\par
\par Sicne ascx file extension is used for ASP.net built-in html component, after the installation of ASP.net, this file extension is treated differentlly as others. So far as I know, there is no way for us to make it downloadable, which is also not encouraged by Microsoft to do so for this kind of modification will affect the ASP.net web applicatoin behavior.
\par
\par If you want to do so, you can develop one ISAPI filter to monitor the ascx request. If one client request the ascx which means he is going to download this file, you can read the ascx file from the server disk and then save it as one temperary file as other file extension dll or exe etc. Then send the temprory file url to the client for the download. After the download completed, the client can only change the file extension to obtain the ascx file.
\par
\par Please feel free to let me know if you have any question.
\par
\par Best Regards,
\par Wei-Dong Xu
\par Microsoft Product Support Services
\par Get Secure! - www.microsoft.com/security
\par This posting is provided "AS IS" with no warranties, and confers no rights.
\par
\par }
------=_NextPart_0001_024C3B48--


RE: Inconsistent behavior when clicking on files in document libra by a

a
Sat Sep 25 12:39:04 CDT 2004

Hi Wei-Dong,

Thanks for your reply. What puzzled me is the inconsistent behavior.

.ascx files have no use unless they are used in a page, and therefore I
don't see a reason why it should be rendered in the browser in the first
place.

RE: Inconsistent behavior when clicking on files in document libra by v-wdxu

v-wdxu
Mon Sep 27 21:19:07 CDT 2004

------=_NextPart_0001_103D6C1D
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Hi,

ASCX is designed for the HTML component used in the page so that we can
make the page design based on different HTML modules; which will provide a
flexible way for us to handle the page design. Since ascx is one special
file extension used for ASP.net, I think we'd better not change the default
behavior.

Please feel free to let me know if you have any question.

Best Regards,
Wei-Dong Xu
Microsoft Product Support Services
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
------=_NextPart_0001_103D6C1D
Content-Type: text/x-rtf
Content-Transfer-Encoding: 7bit

{\rtf1\ansi\ansicpg936\deff0\deflang1033\deflangfe2052{\fonttbl{\f0\fnil\fprq2\fcharset0 MS Sans Serif;}}
\viewkind4\uc1\pard\lang2052\f0\fs16 Hi,
\par
\par ASCX is designed for the HTML component used in the page so that we can make the page design based on different HTML modules; which will provide a flexible way for us to handle the page design. Since ascx is one special file extension used for ASP.net, I think we'd better not change the default behavior.
\par
\par Please feel free to let me know if you have any question.
\par
\par Best Regards,
\par Wei-Dong Xu
\par Microsoft Product Support Services
\par Get Secure! - www.microsoft.com/security
\par This posting is provided "AS IS" with no warranties, and confers no rights.
\par
\par }
------=_NextPart_0001_103D6C1D--