Saturday, March 31, 2012
Straight ASP problem
I am having a weird problem. Currently I have a straight ASP page that
queries an Access database and returns the large recordset on a page that
loops through the recordset and writes the appropriate <td> tags in order to
put the data into a table. Now when I run it in my test environment it runs
no problem, however when I upload to my ISP I get a iis 500 error. But no
error on test server.
A few things: I have noticed that if I decrease the the number of
Response.Write and rstSearch.Fields("FIeldName") code lines that it works
ok on the ISP server.
Any ideas?
JoePart of the web configuration in IIS is the time allowed for a page to run.
If it goes beyond say 900 seconds IIS thinks it's hit an error and declares
a problem.
Another part of the configuration tells IIS what to do with errors; either
give an unhelpful 'an error occurred...' message or give full details to
help the developer figure out what went wrong. In a production environment
IIS is usually set to give no help to potential hackers.
It may simply be that having so many response.write lines in your page takes
too long to process. That would explain why removing some of them fixes the
problem.
Suggestions:
Increase the time-out period by alering the config on your IIS server.
Decrease the size of the recordset. Maybe use paging?
Brian Lowe
--@.
"Joe Coppola" <jocojr@.hotmail.com> wrote in message
news:OyBzKycUEHA.3420@.TK2MSFTNGP12.phx.gbl...
> Hi there.
> I am having a weird problem. Currently I have a straight ASP page that
> queries an Access database and returns the large recordset on a page that
> loops through the recordset and writes the appropriate <td> tags in order
to
> put the data into a table. Now when I run it in my test environment it
runs
> no problem, however when I upload to my ISP I get a iis 500 error. But no
> error on test server.
> A few things: I have noticed that if I decrease the the number of
> Response.Write and rstSearch.Fields("FIeldName") code lines that it works
> ok on the ISP server.
> Any ideas?
> Joe
>
Brian,
Thanks for the reply. I too thought about the timeout setting, but
interestingly I changed the timeout setting on my test server to be like 1
second and I dont get the error, the page just doesnt finish loading
completely. Note I also set the timeout or ASP pages as well.
Is there a way to get a more complete error message?
You are correct the # of response lines is sort of the cause, and I have
thought of paging the results, however, I need the users to be able to
export the whole results to another program... any ideas of this?
Well thanks for the help.
Joe
"Brian Lowe" <no@.reply.address> wrote in message
news:%23ZJsgHeUEHA.2580@.TK2MSFTNGP12.phx.gbl...
> Part of the web configuration in IIS is the time allowed for a page to
run.
> If it goes beyond say 900 seconds IIS thinks it's hit an error and
declares
> a problem.
> Another part of the configuration tells IIS what to do with errors; either
> give an unhelpful 'an error occurred...' message or give full details to
> help the developer figure out what went wrong. In a production environment
> IIS is usually set to give no help to potential hackers.
> It may simply be that having so many response.write lines in your page
takes
> too long to process. That would explain why removing some of them fixes
the
> problem.
> Suggestions:
> Increase the time-out period by alering the config on your IIS server.
> Decrease the size of the recordset. Maybe use paging?
> Brian Lowe
> --@.
> "Joe Coppola" <jocojr@.hotmail.com> wrote in message
> news:OyBzKycUEHA.3420@.TK2MSFTNGP12.phx.gbl...
that
order
> to
> runs
no
works
>
Straight ASP problem
I am having a weird problem. Currently I have a straight ASP page that
queries an Access database and returns the large recordset on a page that
loops through the recordset and writes the appropriate <td> tags in order to
put the data into a table. Now when I run it in my test environment it runs
no problem, however when I upload to my ISP I get a iis 500 error. But no
error on test server.
A few things: I have noticed that if I decrease the the number of
Response.Write and rstSearch.Fields("FIeldName") code lines that it works
ok on the ISP server.
Any ideas?
JoePart of the web configuration in IIS is the time allowed for a page to run.
If it goes beyond say 900 seconds IIS thinks it's hit an error and declares
a problem.
Another part of the configuration tells IIS what to do with errors; either
give an unhelpful 'an error occurred...' message or give full details to
help the developer figure out what went wrong. In a production environment
IIS is usually set to give no help to potential hackers.
It may simply be that having so many response.write lines in your page takes
too long to process. That would explain why removing some of them fixes the
problem.
Suggestions:
Increase the time-out period by alering the config on your IIS server.
Decrease the size of the recordset. Maybe use paging?
Brian Lowe
---@.
"Joe Coppola" <jocojr@.hotmail.com> wrote in message
news:OyBzKycUEHA.3420@.TK2MSFTNGP12.phx.gbl...
> Hi there.
> I am having a weird problem. Currently I have a straight ASP page that
> queries an Access database and returns the large recordset on a page that
> loops through the recordset and writes the appropriate <td> tags in order
to
> put the data into a table. Now when I run it in my test environment it
runs
> no problem, however when I upload to my ISP I get a iis 500 error. But no
> error on test server.
> A few things: I have noticed that if I decrease the the number of
> Response.Write and rstSearch.Fields("FIeldName") code lines that it works
> ok on the ISP server.
> Any ideas?
> Joe
Brian,
Thanks for the reply. I too thought about the timeout setting, but
interestingly I changed the timeout setting on my test server to be like 1
second and I dont get the error, the page just doesnt finish loading
completely. Note I also set the timeout or ASP pages as well.
Is there a way to get a more complete error message?
You are correct the # of response lines is sort of the cause, and I have
thought of paging the results, however, I need the users to be able to
export the whole results to another program... any ideas of this?
Well thanks for the help.
Joe
"Brian Lowe" <no@.reply.address> wrote in message
news:%23ZJsgHeUEHA.2580@.TK2MSFTNGP12.phx.gbl...
> Part of the web configuration in IIS is the time allowed for a page to
run.
> If it goes beyond say 900 seconds IIS thinks it's hit an error and
declares
> a problem.
> Another part of the configuration tells IIS what to do with errors; either
> give an unhelpful 'an error occurred...' message or give full details to
> help the developer figure out what went wrong. In a production environment
> IIS is usually set to give no help to potential hackers.
> It may simply be that having so many response.write lines in your page
takes
> too long to process. That would explain why removing some of them fixes
the
> problem.
> Suggestions:
> Increase the time-out period by alering the config on your IIS server.
> Decrease the size of the recordset. Maybe use paging?
> Brian Lowe
> ---@.
> "Joe Coppola" <jocojr@.hotmail.com> wrote in message
> news:OyBzKycUEHA.3420@.TK2MSFTNGP12.phx.gbl...
> > Hi there.
> > I am having a weird problem. Currently I have a straight ASP page that
> > queries an Access database and returns the large recordset on a page
that
> > loops through the recordset and writes the appropriate <td> tags in
order
> to
> > put the data into a table. Now when I run it in my test environment it
> runs
> > no problem, however when I upload to my ISP I get a iis 500 error. But
no
> > error on test server.
> > A few things: I have noticed that if I decrease the the number of
> > Response.Write and rstSearch.Fields("FIeldName") code lines that it
works
> > ok on the ISP server.
> > Any ideas?
> > Joe
Saturday, March 24, 2012
Strange Error when executing a function
in my code-behind i call a class method that returns a string value...
i run step by step and works great!!
but when i run without breakpoint... sometimes i get error because my string is empty...
and then i run again step by step... and the surprise! works fine again...
why is this happening??
this is my code-behind
string param = " ";param +=ConfigurarLoja.RetParams( );
Session.Add("ssnHabItemVincPromo",param);if(param == " ")
{
response.redirect("~/Erro.aspx");
}And this is my class method:
publicstaticstring RetParams(){
string param ="";int cd_empresa =Convert.ToInt32(HttpContext.Current.Session["ssnCdEmpresa"]);
string sql ="SELECT TOP 1 * FROM LjConfig WHERE cd_empresa = " + cd_empresa +" AND ISNULL(DATEADD(dd, 01, dt_exclusao), GETDATE()) > GETDATE() ORDER BY dt_inclusao DESC";SqlConnection con =newSqlConnection(ConfigurationManager.ConnectionStrings["StringDeConexao"].ConnectionString);con.Open();
SqlCommand cmd =newSqlCommand(sql, con);
SqlDataReader dr = cmd.ExecuteReader();dr.Read();
if (dr.HasRows){
param ="-" + dr["cd_empresa"].ToString().Trim();
}con.Close();
return param;}
ops... it seems solved...
i change the sql command 'WHERE'... i think it was a problem with the GETDATE... now its working fine...
AND (ISNULL(DATEADD(dd, 01, dt_exclusao), DATEADD(dd, 01, GETDATE())) > GETDATE()) "
Strange error with Response.WriteFile and SSL
page which returns a dynamically created PDF file using Response.WriteFile.
When the browser requests this ASPX page via https (SSL) it displays a
message that secure and non secure items are to be displayed (free
translation from german so it might not be the exact wording in english).
When I say no (means non secure items are not displayed) my PDF still is
displayed - so it seems thats not the one causing the message.
Any ideas whats wrong or even better how to solve it?
Regards,
Martin Knopp
fecher GmbH"Martin Knopp" <martin.knopp@.fecher.at> wrote in news:GGVQb.304173$Tz1.135851
@.news.chello.at:
> I have a site running under SSL. Works well so far but there is one ASPX
> page which returns a dynamically created PDF file using Response.WriteFile.
> When the browser requests this ASPX page via https (SSL) it displays a
> message that secure and non secure items are to be displayed (free
> translation from german so it might not be the exact wording in english).
> When I say no (means non secure items are not displayed) my PDF still is
> displayed - so it seems thats not the one causing the message.
> Any ideas whats wrong or even better how to solve it?
It means that somewhere in the content you are sending back are some http://
referendces instead of https:// references. You need to make all images, and
other external type links https://
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"
ELKNews - Get your free copy at http://www.atozedsoftware.com
That would have been easy!
I checked for this already and the only thing we return is a PDF document.
Nothing else.
Today I heard from some source that it might be a problem of IE. I will have
to further investigate this probably.
Any other ideas/hints?
--
Martin Knopp
fecher GmbH
"Chad Z. Hower aka Kudzu" <cpub@.hower.org> schrieb im Newsbeitrag
news:Xns947C29C3EBBCcpub@.127.0.0.1...
> "Martin Knopp" <martin.knopp@.fecher.at> wrote in
news:GGVQb.304173$Tz1.135851
> @.news.chello.at:
> > I have a site running under SSL. Works well so far but there is one ASPX
> > page which returns a dynamically created PDF file using
Response.WriteFile.
> > When the browser requests this ASPX page via https (SSL) it displays a
> > message that secure and non secure items are to be displayed (free
> > translation from german so it might not be the exact wording in
english).
> > When I say no (means non secure items are not displayed) my PDF still is
> > displayed - so it seems thats not the one causing the message.
> > Any ideas whats wrong or even better how to solve it?
> It means that somewhere in the content you are sending back are some
http://
> referendces instead of https:// references. You need to make all images,
and
> other external type links https://
>
> --
> Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
> "Programming is an art form that fights back"
>
> ELKNews - Get your free copy at http://www.atozedsoftware.com
"Martin Knopp" <martin.knopp@.fecher.at> wrote in
news:Lm7Rb.314459$Tz1.163161@.news.chello.at:
> I checked for this already and the only thing we return is a PDF
> document. Nothing else.
Does the PDF have any links in it? IE shouldnt see those but..
Do a view source on the HTML and search for http://
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"
ELKNews - Get your free copy at http://www.atozedsoftware.com
How do you display a PDF?
Do you return the PDF document with proper content type?
Or are you displaying the HTML with embeded PDF?
George.
"Martin Knopp" <martin.knopp@.fecher.at> wrote in message
news:GGVQb.304173$Tz1.135851@.news.chello.at...
> I have a site running under SSL. Works well so far but there is one ASPX
> page which returns a dynamically created PDF file using
Response.WriteFile.
> When the browser requests this ASPX page via https (SSL) it displays a
> message that secure and non secure items are to be displayed (free
> translation from german so it might not be the exact wording in english).
> When I say no (means non secure items are not displayed) my PDF still is
> displayed - so it seems thats not the one causing the message.
> Any ideas whats wrong or even better how to solve it?
> Regards,
> Martin Knopp
> fecher GmbH
I return the PDF with proper contenttype
code-behind in Page_Load event (C#) looks approximately like this:
Response.Clear();
Response.ContentType = "appilcation/pdf";
Response.WriteFile( <local path to PDF document> );
Response.End();
Regards,
Martin Knopp
fecher GmbH
http://www.fecher.at
"George Ter-Saakov" <nospam@.hotmail.com> schrieb im Newsbeitrag
news:OeFFEoC5DHA.2540@.TK2MSFTNGP11.phx.gbl...
> How do you display a PDF?
> Do you return the PDF document with proper content type?
> Or are you displaying the HTML with embeded PDF?
> George.
> "Martin Knopp" <martin.knopp@.fecher.at> wrote in message
> news:GGVQb.304173$Tz1.135851@.news.chello.at...
> > I have a site running under SSL. Works well so far but there is one ASPX
> > page which returns a dynamically created PDF file using
> Response.WriteFile.
> > When the browser requests this ASPX page via https (SSL) it displays a
> > message that secure and non secure items are to be displayed (free
> > translation from german so it might not be the exact wording in
english).
> > When I say no (means non secure items are not displayed) my PDF still is
> > displayed - so it seems thats not the one causing the message.
> > Any ideas whats wrong or even better how to solve it?
> > Regards,
> > Martin Knopp
> > fecher GmbH
go to aspx page you are using for downloads and check to see if in html view
you see any html / aspx elements (if yes remove them)
because when you call Response.Flush they will not be cleared unless you
have default Buffer = true applicable across
a better option for downloads is to use ashx... it httphandler you... they
do offer a performance boost of around 5 - 10%
--
Regards,
HD
Once a Geek... Always a Geek
"Martin Knopp" <martin.knopp@.fecher.at> wrote in message
news:tisRb.330066$Tz1.68379@.news.chello.at...
>I return the PDF with proper contenttype
> code-behind in Page_Load event (C#) looks approximately like this:
> Response.Clear();
> Response.ContentType = "appilcation/pdf";
> Response.WriteFile( <local path to PDF document> );
> Response.End();
> Regards,
> Martin Knopp
> fecher GmbH
> http://www.fecher.at
> "George Ter-Saakov" <nospam@.hotmail.com> schrieb im Newsbeitrag
> news:OeFFEoC5DHA.2540@.TK2MSFTNGP11.phx.gbl...
>> How do you display a PDF?
>> Do you return the PDF document with proper content type?
>> Or are you displaying the HTML with embeded PDF?
>>
>> George.
>>
>> "Martin Knopp" <martin.knopp@.fecher.at> wrote in message
>> news:GGVQb.304173$Tz1.135851@.news.chello.at...
>> > I have a site running under SSL. Works well so far but there is one
>> > ASPX
>> > page which returns a dynamically created PDF file using
>> Response.WriteFile.
>>> > When the browser requests this ASPX page via https (SSL) it displays a
>> > message that secure and non secure items are to be displayed (free
>> > translation from german so it might not be the exact wording in
> english).
>> > When I say no (means non secure items are not displayed) my PDF still
>> > is
>> > displayed - so it seems thats not the one causing the message.
>>> > Any ideas whats wrong or even better how to solve it?
>>> > Regards,
>> > Martin Knopp
>> > fecher GmbH
>>>>
>>
Strange Event Behavior
Scenario:
Class A has a method that returns an instantiated object of Class B.
Class A has a Public Event called "DataUpdated".
When the Class A method is called to return an instance of Class B,
Class A hands to Class B a pointer to itself. Therefore, Class B can
reference the instance of Class A that instantiated it.
Thus, Class B can call the DataUpdated event on the instance of Class A
that instantied it. A method of Class A marked "Friend", called
OnDataUpdated, is called when the "Save" method of Class B is called.
Weirdness:
This all works as planned, but strangely. In an ASP.NET application,
I'm storing an instance of Class A in the Cache. When I call the "Save"
method on Class B, the event bubbles up to the instance of Class A as
expected. However, the event fires up to five times. I've stepped
through the code; the event is only raised once.
Any ideas? Thanks.
Dave Swersky
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!Is it a special needs class?
Try giving them a longer recess. It will allow them to expend some energy
before they return to your classroom.