|Static File Maping though Asp.net|
How do you Map Static Files though Asp.net?
| 12:27 am on Apr 1, 2007 (gmt 0)|
Here my problem, I need to map static files though Asp.Net (on IIS 6, and IIS 5 if all possible). The gotcha is this will be on a shared hosting server so I am limited on access. The changes have to be limited to the specific website only, not server wide.
I have to put together a solution to protect the static files along with the dynamic content, based on login restrictions.
Any help would be appreciated.
| 12:55 am on Apr 1, 2007 (gmt 0)|
I have accomplished this.
Try providing access to the files through a protected or private subroutine using an ASP.NET user control.
What you need to do is create a user control by putting together a separate ASP.NET file with a .ASCX extension. You will need to register it in your .ASPX file with a directive of the following:
<%@ Register TagPrefix="control" TagName="tag" Src="basic.ascx" %>
Then, create file handing visual basic in a private subroutine:
private sub OpenFile
Your File Handing Code...
In your ASPX file that registers your control, use
<control:tag runat="server" />
Read up on Custom ASP Controls/User Controls for more details.
I hope this helps,
| 2:17 am on Apr 1, 2007 (gmt 0)|
I should of explained more that this be more of an addon to the site to add security to an existing application. Meaning I can not change how the current files are saved or current urls used in the application. What I need is how to set static files (html,jpg,gif,css) to be processed by asp.net process and not simply the IIS static file handler which by passes the asp.net process.
| 5:35 am on Apr 1, 2007 (gmt 0)|
You could try my example above and then implement it as a Web Part with a Catalog Web Page Zone.
| 5:57 am on Apr 1, 2007 (gmt 0)|
Ok Here is what I am trying to implement. I have to protect old html (which I am not allowed to change or do anything with). I am not allowed to use file system permissions to limit access. It is require that it use a previously build login system, to limit the access.
All I am asking is there a way to configure IIS so that .html/.css/.jpg/.gif files can be mapped to the ASP.NET ISAPI extension, without going though the IIS Control panel. Basically what I am looking for is a way to upload a page, which when executed it will check the mappings and update them in the metabase so they are routed though asp.net instead of the default IIS static file handler, for the website in question, and not effect the rest of the websites on said webserver.
I know how to make and use HTTP handler to be used in asp.net, thats not the issue. Its just getting it into the asp.net pipeline in the first place.