Showing posts with label classic. Show all posts
Showing posts with label classic. Show all posts

Thursday, March 29, 2012

Seperating Business Logic From Presentation (Using Code Behind)

OK - a question that has been bugging me for so long now...

If i were designing a database driven application in Classic ASP i would write something like the following to access and display the data...

</CODE>
<%
Dim rs
Dim rsArray
Dim i
set rs = server.CreateObject("ADODB.Recordset")
rs.ActiveConnection = Application("connStr")
SQL = "SELECT * FROM...."

rs.Open strSQL
if not (rs.BOF and rs.EOF) Then
rsArray = rs.getRows()
end if
rs.Close

if isArray(rsArray) Then
for i = lbound(rsArray,2) tp ubound(rsArray,2)
%>
<tr>
<td class="class1"><%=rsArray(0,i)%></td>
<td class="class2"><%=.....%></td>
<td rowspan=2><img src=...></td>
</tr>
<%
next
end if
%>
</CODE
Question... To my knowledge the point of code-behind is to seperate the Server-side Code from the Client-Side code.

To that end... how would you go about doing that in ASP.NET? It just doesn't make sense to me.
Even if you did a page_load event that accessed the data how would you then pass that data to the client side code so that you could format it and place it in a table with other client side objects in it like pictures? Or dynamically craete the name of the pictures in the table but doing somethign like <img src="http://pics.10026.com/?src=pic<%=rsArray...%>"...> etc

This part of ASP.Net completely confuses me.I presume i need to use one of the data controls?
Yes, you can use datagrids and repeaters to do the same thing. Get data from your datasource then databind to a repeater or datagrid.

You can also databind to all sorts of other controls (dropdown lists, check box lists, radio lists...)
and using those controls i can format/arrange my data as i want?

is there a simple coding example?
Yeah, the tutorials on this site have some examples.

You can format the data any way you want. It'll take some getting use to. You'd use data binding syntax instead of <% %>, which actually still feels like you're mixing code in with html... but it's supposed to be better somehow.

Tuesday, March 13, 2012

server application unavailable

hallo,
i'm going to ask a solution for a "classic" problem. actually i read a
lot about possible solutions to it but i was not able to solve it.
the "patient" is:
- a test server where i have "limited" power (alias, i cannot re-
install everything i want :-/)
- Windows 2000 sp 4 w/ iis 5.0
- .net frameworks installed: 1.0, 1.1, 2.0
- a bunch of *working* webapplications associated w/ framework 1.1
- a web application which does not work associated w/ framework 2.0 (i
checked the associations with the ASPNETVersionSwitcher tool)
symptoms:
- when i load the not-working application via browser, i get the red
error message "Server Application Unavailable"
- i checked the Event Viewer, here is what it says:
1. aspnet_wp.exe (PID: 2620) stopped unexpectedly.
2. Failed to execute the request because the ASP.NET process identity
does not have read permissions to the global assembly cache. Error:
0x80004005 Unspecified error
what i did:
- i read these two articles telling how to set the permission for
<machinename>\ASPNET account:
http://forums.microsoft.com/MSDN/Sh...135969&SiteID=1
http://support.microsoft.com/?scid=...B811320&x=9&y=9
still, after having set the permissions as the articles say, the
problem still remains.
do you have any other suggestions?
francesco
PS
all the guides i read say that after installing .net framework v2.0 it
should appear a tab titled "ASP.NET" in the iis web site property
page... that does not happen to me. is that normal?Last time I had error like that ASP.NET did not have any permissions (I
think all it need is read) to the BIN folder of my application
George.
"Francesco Spegni" <francesco.spegni@.gmail.com> wrote in message
news:1174993540.662501.226120@.l77g2000hsb.googlegroups.com...
> hallo,
> i'm going to ask a solution for a "classic" problem. actually i read a
> lot about possible solutions to it but i was not able to solve it.
> the "patient" is:
> - a test server where i have "limited" power (alias, i cannot re-
> install everything i want :-/)
> - Windows 2000 sp 4 w/ iis 5.0
> - .net frameworks installed: 1.0, 1.1, 2.0
> - a bunch of *working* webapplications associated w/ framework 1.1
> - a web application which does not work associated w/ framework 2.0 (i
> checked the associations with the ASPNETVersionSwitcher tool)
> symptoms:
> - when i load the not-working application via browser, i get the red
> error message "Server Application Unavailable"
> - i checked the Event Viewer, here is what it says:
> 1. aspnet_wp.exe (PID: 2620) stopped unexpectedly.
> 2. Failed to execute the request because the ASP.NET process identity
> does not have read permissions to the global assembly cache. Error:
> 0x80004005 Unspecified error
> what i did:
> - i read these two articles telling how to set the permission for
> <machinename>\ASPNET account:
> http://forums.microsoft.com/MSDN/Sh...135969&SiteID=1
> http://support.microsoft.com/?scid=...B811320&x=9&y=9
> still, after having set the permissions as the articles say, the
> problem still remains.
> do you have any other suggestions?
> francesco
> PS
> all the guides i read say that after installing .net framework v2.0 it
> should appear a tab titled "ASP.NET" in the iis web site property
> page... that does not happen to me. is that normal?
>
thanks, but the user (<machine_name>/ASPNET) has access to the bin
directory :-/
On 27 Mar, 13:38, "George Ter-Saakov" <gt-...@.cardone.com> wrote:
> Last time I had error like that ASP.NET did not have any permissions (I
> think all it need is read) to the BIN folder of my application
> George.
> "Francesco Spegni" <francesco.spe...@.gmail.com> wrote in message
> news:1174993540.662501.226120@.l77g2000hsb.googlegroups.com...
>
I think you answered your own question. the ASPNET process cannot read the
GAC. So you need to find out how to grant the proper permissions.
Sounds like you've got a messed up installation. Also, make sure your 2.0
app(s) are running under their OWN application pool.
Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net
"Francesco Spegni" wrote:

> hallo,
> i'm going to ask a solution for a "classic" problem. actually i read a
> lot about possible solutions to it but i was not able to solve it.
> the "patient" is:
> - a test server where i have "limited" power (alias, i cannot re-
> install everything i want :-/)
> - Windows 2000 sp 4 w/ iis 5.0
> - .net frameworks installed: 1.0, 1.1, 2.0
> - a bunch of *working* webapplications associated w/ framework 1.1
> - a web application which does not work associated w/ framework 2.0 (i
> checked the associations with the ASPNETVersionSwitcher tool)
> symptoms:
> - when i load the not-working application via browser, i get the red
> error message "Server Application Unavailable"
> - i checked the Event Viewer, here is what it says:
> 1. aspnet_wp.exe (PID: 2620) stopped unexpectedly.
> 2. Failed to execute the request because the ASP.NET process identity
> does not have read permissions to the global assembly cache. Error:
> 0x80004005 Unspecified error
> what i did:
> - i read these two articles telling how to set the permission for
> <machinename>\ASPNET account:
> http://forums.microsoft.com/MSDN/Sh...135969&SiteID=1
> http://support.microsoft.com/?scid=...B811320&x=9&y=9
> still, after having set the permissions as the articles say, the
> problem still remains.
> do you have any other suggestions?
> francesco
> PS
> all the guides i read say that after installing .net framework v2.0 it
> should appear a tab titled "ASP.NET" in the iis web site property
> page... that does not happen to me. is that normal?
>
On 28 Mar, 01:01, Peter Bromberg [C# MVP]
<pbromb...@.yahoo.yabbadabbadoo.com> wrote:
> I think you answered your own question. the ASPNET process cannot read the
> GAC. So you need to find out how to grant the proper permissions.
> Sounds like you've got a messed up installation. Also, make sure your 2.0
> app(s) are running under their OWN application pool.
> Peter
uhm,
i'm not an expert in iis but i think that application pools are
configurable for iis 6 or successive ones, while i'm using iis 5. am i
wrong? if i'm wrong, could you point me to some documentation about
that?
moreover: which files is the GAC made of, actually? just the ones in
%windir%\assembly? i'm asking you this because i've already checked
they are readable by ASPNET user.
thanks
francesco