Saturday, March 24, 2012

working with HTTPRequest in Page_Load - problems.

Hello,

Hello

I'm tinkering with .NET, and I like the idea of being able to use compiled c# in
"code behind" even where the client side user doesn't have the .net framework
installed, i.e. for general web based applications.

So what I did was remove everything in the .aspx file except the

<%@dotnet.itags.org. Page language="c#" Codebehind="WebForm2.aspx.cs" AutoEventWireup="false"
Inherits="lmyProj.WebForm2" %
line.

My idea was to handle the Request in the Page_Load method of the code behind.
I can output data using the Response property OK, but the Request seems to be
uninitialised - for instance if I send a form which invokes my page, the "Form"
property has Count = 0, not 1.

Also if the form includes a "File" component, the count of files in the request
is always 0. (I have set enctype="multipart/form-data")

I'm doing this so I can run what is to all intents and purposes a CGI executable
on in an ISP who doesn't allow executables, but does allow ASP.NET.

Maybe I should be pursuing some other route?

Or any other help, pointers greatfully received...

JimOK - I fixed it - so for posterity and future Googlers of the group :-

1) specificy method = post

<form id="Form1" action="http://localhost/listyourself/webform2.aspx"
enctype="multipart/form-data" method=post
2) input *must* have a name attribute, or it doesn't appear in the "files"
collection ...
<INPUT type="file" id="fileone" name="fileone"
and that seems to be it, then the data turns up in the request, and faking can
continue :-)

J
On Tue, 11 Nov 2003 13:03:06 GMT, jimlawton@.getit.someotherway (Jim Lawton)
wrote:

>Hello,
>Hello
>I'm tinkering with .NET, and I like the idea of being able to use compiled c# in
>"code behind" even where the client side user doesn't have the .net framework
>installed, i.e. for general web based applications.

So now I've discovered that *theoretically* it all works for any browser on any
os (ho ho ho) - but anyway, there's no requirement to have the .net framework
installed.

But and, the whole thrust of my idea was dross, and there is a much more elegant
solution to the problem, an example i+ the creation of dynamic pages using
XML/XSL at :-

http://www.sitepoint.com/article/1001/1

Got to stop answering my own questions :-)

Jim

0 comments:

Post a Comment