working with HTTPRequest in Page_Load - problems.

J

Jim Lawton

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

<%@ 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...

Jim
 
J

Jim Lawton

OK - 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
 
J

Jim Lawton

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top