Showing posts with label request. Show all posts
Showing posts with label request. Show all posts

Saturday, March 31, 2012

the asp.net equivalent of the "Request.Form" in asp

i am having problems with a simple web service i am creating in asp.net using C#. does anybody know what Request.Form is in asp.net.
cheers
much appreciatedI've never done classic ASP code, but I think what you're looking for is Request.Params[]

Should still be Request.Form. What is the problem that you are having?


Hi,
Request.Form method was used in classic ASP(3.0)
<form action="hello.aspx" method="post">
Your name: <input type="text" name="fname" size="20">
<input type="submit" value="Submit">
</form>
<%
dim fname
fname=Request.Form("fname")
Response.Write("Hello " & fname)
%>
As in Asp.net forms are posted to itself So Request.Form was not actively used in asp.net.
Iam still now able to understand why you require this in web services.


You can still use Request.Form, but you'll have to make sure the value exists before trying to use it. In Classic ASP, if the value didn't exist it would return an empty string, but in ASP.NET you get Nothing (in VB.NET, which I believe is null in C#).

Wednesday, March 28, 2012

The Cache object

Hello!

Is there a way to get to the Cache object in some other way than the
current contex?
I mean - the Cache is independant from the request so I would expect to
see some kind of Cache.Current property or something like
HttpContext.Current, but unfortunately I've been unable to find one.
When it could be usefull is for example a situation when I put some
task to be done every few minutes on the server - independent from the
requests comming in.
The way I do it now is to catch one of the Requests, get the Cache from
there and store the reference to it in some global/static variable.

--
MichalHttpRuntime.Cache

You might need to reference the System.Web assembly, but you can use it for
any type of application, including windows forms, console, web service...

Karl

--
http://www.openmymind.net/

"Mikeon" <mikeon@dotnet.itags.org.icpnet.pl> wrote in message
news:1142928776.985959.270680@dotnet.itags.org.u72g2000cwu.googlegr oups.com...
> Hello!
> Is there a way to get to the Cache object in some other way than the
> current contex?
> I mean - the Cache is independant from the request so I would expect to
> see some kind of Cache.Current property or something like
> HttpContext.Current, but unfortunately I've been unable to find one.
> When it could be usefull is for example a situation when I put some
> task to be done every few minutes on the server - independent from the
> requests comming in.
> The way I do it now is to catch one of the Requests, get the Cache from
> there and store the reference to it in some global/static variable.
> --
> Michal
Hello!

Yep, I'm already referencing it, but! What I need is a way to get the
Cache object without the Context object which is only available during
request processing which is not allways the case when some code on the
server runs as in my example with tasks running on the server every few
minutes. The importatnt part is that the tasks are run even if no one
uses my application i.e.: no one is requesting pages at the moment and
there is some Timer object stored in the Application state which fires
some tasks.

--
Michal
Not sure if you read what I said, but you can use the HttpRuntime.Cache
which IS available even without a context..

Karl

--
http://www.openmymind.net/
http://www.fuelindustries.com/

"Mikeon" <mikeon@dotnet.itags.org.icpnet.pl> wrote in message
news:1142945004.761815.70410@dotnet.itags.org.z34g2000cwc.googlegro ups.com...
> Hello!
> Yep, I'm already referencing it, but! What I need is a way to get the
> Cache object without the Context object which is only available during
> request processing which is not allways the case when some code on the
> server runs as in my example with tasks running on the server every few
> minutes. The importatnt part is that the tasks are run even if no one
> uses my application i.e.: no one is requesting pages at the moment and
> there is some Timer object stored in the Application state which fires
> some tasks.
> --
> Michal
Thus wrote Mikeon,

> Hello!
> Is there a way to get to the Cache object in some other way than the
> current contex?
> I mean - the Cache is independant from the request so I would expect
> to
> see some kind of Cache.Current property or something like
> HttpContext.Current, but unfortunately I've been unable to find one.
> When it could be usefull is for example a situation when I put some
> task to be done every few minutes on the server - independent from the
> requests comming in.
> The way I do it now is to catch one of the Requests, get the Cache
> from
> there and store the reference to it in some global/static variable.

You can also consider using the Caching Application Block in EL 2.0. The
API is similar to ASP.NET's Cache class.

Cheers,
--
Joerg Jooss
news-reply@dotnet.itags.org.joergjooss.de
Hello!

Oh! I've missed this first line of yours. Of course it is what I was
looking for.
Thank you!

--
Michal

The Cache object

Hello!
Is there a way to get to the Cache object in some other way than the
current contex?
I mean - the Cache is independant from the request so I would expect to
see some kind of Cache.Current property or something like
HttpContext.Current, but unfortunately I've been unable to find one.
When it could be usefull is for example a situation when I put some
task to be done every few minutes on the server - independent from the
requests comming in.
The way I do it now is to catch one of the Requests, get the Cache from
there and store the reference to it in some global/static variable.
MichalHttpRuntime.Cache
You might need to reference the System.Web assembly, but you can use it for
any type of application, including windows forms, console, web service...
Karl
http://www.openmymind.net/
"Mikeon" <mikeon@dotnet.itags.org.icpnet.pl> wrote in message
news:1142928776.985959.270680@dotnet.itags.org.u72g2000cwu.googlegroups.com...
> Hello!
> Is there a way to get to the Cache object in some other way than the
> current contex?
> I mean - the Cache is independant from the request so I would expect to
> see some kind of Cache.Current property or something like
> HttpContext.Current, but unfortunately I've been unable to find one.
> When it could be usefull is for example a situation when I put some
> task to be done every few minutes on the server - independent from the
> requests comming in.
> The way I do it now is to catch one of the Requests, get the Cache from
> there and store the reference to it in some global/static variable.
> --
> Michal
>
Hello!
Yep, I'm already referencing it, but! What I need is a way to get the
Cache object without the Context object which is only available during
request processing which is not allways the case when some code on the
server runs as in my example with tasks running on the server every few
minutes. The importatnt part is that the tasks are run even if no one
uses my application i.e.: no one is requesting pages at the moment and
there is some Timer object stored in the Application state which fires
some tasks.
Michal
Not sure if you read what I said, but you can use the HttpRuntime.Cache
which IS available even without a context..
Karl
http://www.openmymind.net/
http://www.fuelindustries.com/
"Mikeon" <mikeon@dotnet.itags.org.icpnet.pl> wrote in message
news:1142945004.761815.70410@dotnet.itags.org.z34g2000cwc.googlegroups.com...
> Hello!
> Yep, I'm already referencing it, but! What I need is a way to get the
> Cache object without the Context object which is only available during
> request processing which is not allways the case when some code on the
> server runs as in my example with tasks running on the server every few
> minutes. The importatnt part is that the tasks are run even if no one
> uses my application i.e.: no one is requesting pages at the moment and
> there is some Timer object stored in the Application state which fires
> some tasks.
> --
> Michal
>
Thus wrote Mikeon,

> Hello!
> Is there a way to get to the Cache object in some other way than the
> current contex?
> I mean - the Cache is independant from the request so I would expect
> to
> see some kind of Cache.Current property or something like
> HttpContext.Current, but unfortunately I've been unable to find one.
> When it could be usefull is for example a situation when I put some
> task to be done every few minutes on the server - independent from the
> requests comming in.
> The way I do it now is to catch one of the Requests, get the Cache
> from
> there and store the reference to it in some global/static variable.
You can also consider using the Caching Application Block in EL 2.0. The
API is similar to ASP.NET's Cache class.
Cheers,
--
Joerg Jooss
news-reply@dotnet.itags.org.joergjooss.de
Hello!
Oh! I've missed this first line of yours. Of course it is what I was
looking for.
Thank you!
Michal