473,395 Members | 1,418 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

show source

Seb
With php I can simply append a s to the file extension, eg. .phps and
if the user request the file the source will be shown in the browser.

Is there a semilar functionality for aspx pages?

best regards,
seb
Jul 28 '08 #1
13 1570
Seb has brought this to us :
With php I can simply append a s to the file extension, eg. .phps and
if the user request the file the source will be shown in the browser.

Is there a semilar functionality for aspx pages?

best regards,
seb
What source do you mean? There is the aspx file itself, it's codebehind
file and there may be any number of supporting classes.

Depending on the compilation model used, all of these could be absent
from your server!

As far as I know, it is not possible to request any of these sources
(fortunately!). The retrieval of some support files (*.config for
example) is even actively blocked bij ASP.Net!

Hans Kesting
Jul 28 '08 #2
Seb
On Jul 28, 3:21*pm, Hans Kesting <news.han...@spamgourmet.comwrote:
Seb has brought this to us :
With php I can simply append a s to the file extension, eg. .phps and
if the user request the file the source will be shown in the browser.
Is there a semilar functionality for aspx pages?
best regards,
seb

What source do you mean? There is the aspx file itself, it's codebehind
file and there may be any number of supporting classes.
aspx, cs and so on.
Depending on the compilation model used, all of these could be absent
from your server!
True, but they aren't :)
As far as I know, it is not possible to request any of these sources
(fortunately!). The retrieval of some support files (*.config for
example) is even actively blocked bij ASP.Net!
It's so I could easily show my source to a group like this.
best regards,
seb
Jul 31 '08 #3
I do not get your problem...

If you have developed an application then you should have a source.
If you have not then it would be a security problem to allow you to see the
cource.

PS: I tried to add .phps instead of .php on the
http://www.php.net/archive/2008.php
and all i do not see any souce, only custom 404 page
George.

"Seb" <se******************@gmail.comwrote in message
news:bd**********************************@l42g2000 hsc.googlegroups.com...
On Jul 28, 3:21 pm, Hans Kesting <news.han...@spamgourmet.comwrote:
Seb has brought this to us :
With php I can simply append a s to the file extension, eg. .phps and
if the user request the file the source will be shown in the browser.
Is there a semilar functionality for aspx pages?
best regards,
seb

What source do you mean? There is the aspx file itself, it's codebehind
file and there may be any number of supporting classes.
aspx, cs and so on.
Depending on the compilation model used, all of these could be absent
from your server!
True, but they aren't :)
As far as I know, it is not possible to request any of these sources
(fortunately!). The retrieval of some support files (*.config for
example) is even actively blocked bij ASP.Net!
It's so I could easily show my source to a group like this.
best regards,
seb

Jul 31 '08 #4
Hello George,

Granted, you should have the source code already, but for easier access via
web, the only way I can think to do this would be to create an HTTP Handler,
set it up on the web.config file, and register the file extensions in the
app config on the IIS server. The HTTP handler would intercept, for example,
yourpage.aspx.source calls to the web server and depending on the name prior
to '.source' the handler would grab that file and read the contents out to
you on the webpage, checking code-behind and inline page code. That seems
the best method to me...

If you don't know how to write an HTTP Handler and set it up, there's basically
no way other than to have the original source... Or you could just remove
the aspx mapping in the app config, but then the site wouldn't work at all.
I do not get your problem...

If you have developed an application then you should have a source.
If you have not then it would be a security problem to allow you to
see the
cource.
PS: I tried to add .phps instead of .php on the
http://www.php.net/archive/2008.php
and all i do not see any souce, only custom 404 page
George.

"Seb" <se******************@gmail.comwrote in message
news:bd**********************************@l42g2000 hsc.googlegroups.com
... On Jul 28, 3:21 pm, Hans Kesting <news.han...@spamgourmet.com>
wrote:
>Seb has brought this to us :
>>With php I can simply append a s to the file extension, eg. .phps
and if the user request the file the source will be shown in the
browser.

Is there a semilar functionality for aspx pages?

best regards,
seb
What source do you mean? There is the aspx file itself, it's
codebehind file and there may be any number of supporting classes.
aspx, cs and so on.
>Depending on the compilation model used, all of these could be absent
from your server!
True, but they aren't :)
>As far as I know, it is not possible to request any of these sources
(fortunately!). The retrieval of some support files (*.config for
example) is even actively blocked bij ASP.Net!
It's so I could easily show my source to a group like this.

best regards,
seb

Jul 31 '08 #5
Sorry, my posting program automatically added George to the top of the response.
The previous one was intended for Seb
I do not get your problem...

If you have developed an application then you should have a source.
If you have not then it would be a security problem to allow you to
see the
cource.
PS: I tried to add .phps instead of .php on the
http://www.php.net/archive/2008.php
and all i do not see any souce, only custom 404 page
George.

"Seb" <se******************@gmail.comwrote in message
news:bd**********************************@l42g2000 hsc.googlegroups.com
... On Jul 28, 3:21 pm, Hans Kesting <news.han...@spamgourmet.com>
wrote:
>Seb has brought this to us :
>>With php I can simply append a s to the file extension, eg. .phps
and if the user request the file the source will be shown in the
browser.

Is there a semilar functionality for aspx pages?

best regards,
seb
What source do you mean? There is the aspx file itself, it's
codebehind file and there may be any number of supporting classes.
aspx, cs and so on.
>Depending on the compilation model used, all of these could be absent
from your server!
True, but they aren't :)
>As far as I know, it is not possible to request any of these sources
(fortunately!). The retrieval of some support files (*.config for
example) is even actively blocked bij ASP.Net!
It's so I could easily show my source to a group like this.

best regards,
seb

Jul 31 '08 #6
Yea, I guess you could add a Handler,

I would probably analyze query string or path for something like
mypage.aspx?source=1
or
mypage.aspx/source

The problem with mypage.aspx.source is that you would need to register
extension .source with ASP.NET dll (in IIS Management console)
--------------------------------------

Anyway, i never had need to display the source for myslef.... :)

George.

"The Colorado Kid" <tckwrote in message
news:9d*************************@newsgroups.comcas t.net...
Hello George,

Granted, you should have the source code already, but for easier access
via web, the only way I can think to do this would be to create an HTTP
Handler, set it up on the web.config file, and register the file
extensions in the app config on the IIS server. The HTTP handler would
intercept, for example, yourpage.aspx.source calls to the web server and
depending on the name prior to '.source' the handler would grab that file
and read the contents out to you on the webpage, checking code-behind and
inline page code. That seems the best method to me...

If you don't know how to write an HTTP Handler and set it up, there's
basically no way other than to have the original source... Or you could
just remove the aspx mapping in the app config, but then the site wouldn't
work at all.
>I do not get your problem...

If you have developed an application then you should have a source.
If you have not then it would be a security problem to allow you to
see the
cource.
PS: I tried to add .phps instead of .php on the
http://www.php.net/archive/2008.php
and all i do not see any souce, only custom 404 page
George.

"Seb" <se******************@gmail.comwrote in message
news:bd**********************************@l42g200 0hsc.googlegroups.com
... On Jul 28, 3:21 pm, Hans Kesting <news.han...@spamgourmet.com>
wrote:
>>Seb has brought this to us :

With php I can simply append a s to the file extension, eg. .phps
and if the user request the file the source will be shown in the
browser.

Is there a semilar functionality for aspx pages?

best regards,
seb
What source do you mean? There is the aspx file itself, it's
codebehind file and there may be any number of supporting classes.
aspx, cs and so on.
>>Depending on the compilation model used, all of these could be absent
from your server!
True, but they aren't :)
>>As far as I know, it is not possible to request any of these sources
(fortunately!). The retrieval of some support files (*.config for
example) is even actively blocked bij ASP.Net!
It's so I could easily show my source to a group like this.

best regards,
seb

Jul 31 '08 #7
Seb
On Jul 31, 7:23*pm, "George" <noem...@comcast.netwrote:
I do not get your problem...

If you have developed an application then you should have a source.
If you have not then it would be a security problem to allow you to see the
cource.
Not if you want to expose the source to a group like this.
PS: I tried to add .phps instead of .php on thehttp://www.php.net/archive/2008.php
and all i do not see any souce, only custom 404 page
If you change the extension to .phps if will present the source code,
not output of the parsed php code.
Aug 1 '08 #8
Seb
On Jul 31, 10:40*pm, The Colorado Kid <tckwrote:
Hello George,

Granted, you should have the source code already, but for easier access via
web, the only way I can think to do this would be to create an HTTP Handler,
set it up on the web.config file, and register the file extensions in the
app config on the IIS server. The HTTP handler would intercept, for example,
yourpage.aspx.source calls to the web server and depending on the name prior
to '.source' the handler would grab that file and read the contents out to
you on the webpage, checking code-behind and inline page code. That seems
the best method to me...

If you don't know how to write an HTTP Handler and set it up, there's basically
no way other than to have the original source... Or you could just remove
the aspx mapping in the app config, but then the site wouldn't work at all.
Inspired by http://msdn.microsoft.com/en-us/library/ms228090.aspx

Quick and dirty:
using System.Web;
using System.IO;
public class SourceHandler : IHttpHandler
{
public SourceHandler()
{
}

public void ProcessRequest(HttpContext context)
{
HttpRequest Request = context.Request;
HttpResponse Response = context.Response;
HttpServerUtility Server = context.Server;

string file = File.ReadAllText(Server.MapPath(Request.FilePath)) ;
file = Server.HtmlEncode(file);

file = file.Replace("\r\n", "<br />");
file = file.Replace("\t", "&nbsp;&nbsp;&nbsp;&nbsp;");

//surround this with valid html
Response.Write(file);
}

public bool IsReusable
{
// To enable pooling, return true here.
// This keeps the handler in memory.
get { return false; }
}
}

Thanks a lot :)
Aug 1 '08 #9
Seb
On Jul 31, 11:09*pm, "George" <noem...@comcast.netwrote:
Yea, I guess you could add a Handler,

I would probably analyze query string or path for something like
mypage.aspx?source=1
or
mypage.aspx/source

The problem with mypage.aspx.source is that you would need to register
extension .source with ASP.NET dll (in IIS Management console)
Simply add the handler to web.config
>
Anyway, i never had need to display the source for myslef.... :)
You should share more :)
best regards,
seb
Aug 1 '08 #10
Seb,

Does this method seem to be working for you?
On Jul 31, 10:40 pm, The Colorado Kid <tckwrote:
>Hello George,

Granted, you should have the source code already, but for easier
access via web, the only way I can think to do this would be to
create an HTTP Handler, set it up on the web.config file, and
register the file extensions in the app config on the IIS server. The
HTTP handler would intercept, for example, yourpage.aspx.source calls
to the web server and depending on the name prior to '.source' the
handler would grab that file and read the contents out to you on the
webpage, checking code-behind and inline page code. That seems the
best method to me...

If you don't know how to write an HTTP Handler and set it up, there's
basically
no way other than to have the original source... Or you could just
remove
the aspx mapping in the app config, but then the site wouldn't work
at all.
Inspired by http://msdn.microsoft.com/en-us/library/ms228090.aspx

Quick and dirty:
using System.Web;
using System.IO;
public class SourceHandler : IHttpHandler
{
public SourceHandler()
{
}
public void ProcessRequest(HttpContext context)
{
HttpRequest Request = context.Request;
HttpResponse Response = context.Response;
HttpServerUtility Server = context.Server;
string file = File.ReadAllText(Server.MapPath(Request.FilePath)) ;
file = Server.HtmlEncode(file);
file = file.Replace("\r\n", "<br />");
file = file.Replace("\t", "&nbsp;&nbsp;&nbsp;&nbsp;");
//surround this with valid html
Response.Write(file);
}
public bool IsReusable
{
// To enable pooling, return true here.
// This keeps the handler in memory.
get { return false; }
}
}
Thanks a lot :)

Aug 1 '08 #11
>>Simply add the handler to web.config
Which version of IIS are you running you code under? Cause it's not that
simple...
If you running it under the Server that comes with Visual Studio (ASP.NET
Development Server) then you are in for some problems once you move it to
production....

George.

"Seb" <se******************@gmail.comwrote in message
news:72**********************************@e53g2000 hsa.googlegroups.com...
On Jul 31, 11:09 pm, "George" <noem...@comcast.netwrote:
Yea, I guess you could add a Handler,

I would probably analyze query string or path for something like
mypage.aspx?source=1
or
mypage.aspx/source

The problem with mypage.aspx.source is that you would need to register
extension .source with ASP.NET dll (in IIS Management console)
Simply add the handler to web.config
>
Anyway, i never had need to display the source for myslef.... :)
You should share more :)
best regards,
seb

Aug 1 '08 #12
Seb
On Aug 1, 7:38*pm, The Colorado Kid <tckwrote:
Seb,

Does this method seem to be working for you?
Locally it does... :(
Aug 3 '08 #13
Seb
On Aug 2, 12:47*am, "George" <noem...@comcast.netwrote:
>Simply add the handler to web.config

Which version of IIS are you running you code under? Cause it's not that
simple...
If you running it under the Server that comes with Visual Studio (ASP.NET
Development Server) then you are in for some problems once you move it to
production....
I realized that... Is there a way to make this work with a standard
host? surftown in my case... or do I need access to iis manager?

best regards,
seb
Aug 3 '08 #14

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: bayram guzer | last post by:
hi everybody, i have very strange error. i can not see some of the asp pages on my browser. when i look from view source, all the source is there but browser does not show anything, just an empty...
13
by: | last post by:
Although this question does not belong in here, I hope someone help, as I do not know where to send it, but someone here might have come acros similar problem: Some of JPG files sitting in the...
5
by: jrefactors | last post by:
I am trying to debug some values in production server. I want to print the value of rRes(10), but I don't want to show it in the screen. I just want to show it in the source code but comment out,...
6
by: John Dalberg | last post by:
Why does IE not show the full html source when I try to view the source?? I mean why does it hide a few features. Previously I had an issue where the data grid html representation was hidden in...
8
by: pmud | last post by:
Hi, I am using a compare validator in asp.net application(c# code). This Custom validator is used for comparing a value enterd by the user against the primary key in the SQL database. IF the...
6
by: mike11d11 | last post by:
My program has to tables in it. One is the Accounts table with all personal information and then there is also my Memos table with all the notes for each account. My program displays one record...
2
by: banderson | last post by:
Hello, I have a data entry form for a table with information about buildings and am having a problem making a combo box do what I want. I would like to make the combo box show a list of unique bldg...
1
by: =?Utf-8?B?UGF1bCBT?= | last post by:
Hi I have created a collection of business objects in a seperate dll, which I have then added to my web project. However it does not show up in list of Website Data Sources. I need to Data...
8
by: zufie | last post by:
Hi, I created some forms using the "Create form using Wizard". However, I cannot view the forms I created with Wizard unless I click on the Design View icon. I checked the forms' properties...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.