• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 600
  • Last Modified:

physical html files on fly asp.net vs2005

can we genrate HTL files on the fly? like client enters data in a text box his physical file is created on the server like free web page. using  from choice of master Pages.

VS2005, ASP.NET C#
0
dontnetsanjay
Asked:
dontnetsanjay
1 Solution
 
DropZoneCommented:
Hum... If I understand you correctly, you want to generate dynamicallly the output rendered to the user, right?  Well, this is precisely what .NET is intended for.  There are many ways to go about this.  One is to dynamically populate the page with controls as it is being prepared for rendering.  You could override the OnInit() or OnPreRender() methods and add controls at will.

My preferred method is to use dynamic templates (I am still stuck using .NET 1.1, so I have no access to master pages).  But I suppose that with master pages it is even easier.

    -dZ.
0
 
dontnetsanjayAuthor Commented:
hello dropzone,
not this what i want to know
dynamically generating content for a web page thru databases text file or xml
using master pages or user controls are different concepts

create a physical html file suppose i have ntered file namein a text box say drop.html
then only we will check whether file exists or not and if ot then we create a file drop.html and adding content to that file is secondary issue which is not my query

0
 
DropZoneCommented:
I understand.  This is possible.

You can dynamically change the URL by using the HttpContext.RewritePath() method.  You can do this from the Application_BeginRequest() event.  At that point, you can check if the file exists, and if not, create it.  You can also set a custom ASPX page for the 404 error (file not found), and in this page, generate dynamic content depending on the original request.

It depends on what you want to do ultimately.  If you provide more details, we may be able to offer specific help.

     -dZ.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
DropZoneCommented:
0
 
existenz2Commented:
I would suggest to use a component like Rewrite.NET. This allows the user to navigate the page "drop.html", but you don't need to actually create it. You can store the content in a database and use 1 page with a literal control on it which will hold all content.

You can find more information on: http://www.15seconds.com/Issue/030522.htm
0
 
DBAduck - Ben MillerPrincipal ConsultantCommented:
If I understand you right, you really want to know if you can create a file and save it to your website.

Yes you can do this if you have CREATE rights on the folder (I mean the anonymous rights user).
You can use File.Exists(path) to find out if it exists, and you can use FileStream fs = File.Create(path).

Take a look at this http://msdn2.microsoft.com/en-us/library/system.io.filestream(VS.71).aspx

It explains how to use the FileStream object.  But inside the file you create, you can put all the header information like <%@ Page MasterPageFile="~/sometihing.master" ... %>

HTH.
Ben.
0
 
dontnetsanjayAuthor Commented:
hey dbaduck,

thanks for the answer thats what i wanted to know and its completely clear now thanks

Sanjay
0

Featured Post

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now