Link to home
Start Free TrialLog in
Avatar of Floyd Shadwick
Floyd ShadwickFlag for United States of America

asked on

ASP VB.NET application ignores Response.Write no error

Hello all. I have an ASP.NET web forms application that has been working fine until a recent change from cookies to session variables (don't think that has anything to do with it but ...) and an upgrade of the Telerik controls.
The same code behind, in two separate ASPX pages (print and reprint), behave differently. They both use this format:

1 Dim PrintCmd as String = "PrintForm.aspx?var1=value&var2=value..."
2 PrintCmd =  "<script language=javascript> {window.open('" & PrintCmd & "', '_blank');}</script>"
3 WriteNlog.Info(PrintCmd)
4 Response.Write(PrintCmd)
5 Response.Write(PrintCmd.Replace("Some Text","Other Text")
6 CallNlog.Info("Returned from print")

The page being called is a simple ASPX that copies the query values to labels and then the body performs window.print() then window.close(). It makes an NLog entry at preload and load, when it works.

Page1.aspx executes 1,2,3 and 6. Logging in the PrintForm.aspx does not occur, no error is reported, as if 4 and 5 are comments.
Page2.aspx executes 1 through 6 without fail.

Both origination forms use the same site master with Telerik controls (RadScriptManager, RadMenu, RadAjaxLoadingPanel and RadAjaxManager).
The print page is pure ASP webform.

Alternately I have tried:
4 ClientScript.RegisterStartupScript(Me.GetType(), "receipt1", PrintCmd, True)
5 ClientScript.RegisterStartupScript(Me.GetType(), "receipt2", PrintCmd.Replace("Some Text","Other Text"), True)

Again, page2 works flawlessly and page1 fails consistently with no error.

Anyone have any ideas I can praise you for?
Thanks.
Avatar of HainKurt
HainKurt
Flag of Canada image

did you check source...
maybe it is writing somewhere that you dont see :)
search for that message in source...
Avatar of Floyd Shadwick

ASKER

Thanks for the response and yes, I did.

The first page doesn't even process the Response.Write. I added a stream writer to a local text file in the preload and that isn't being processed when run from the first page, but consistently does from the second. I'm trying to imagine what would interfere with it but can't.

The other developers here just stare at it and shrug.
need to see code... it does not make sense to me...
Following another suggestion I checked the application logs.
There were some entries but after correcting them nothing changed in the bad behavior.

I know it doesn't make sense. If I had any hair left I'd be pulling it out. ;)

This is literally the code running on both pages with the variable names and values changed.
I've tried two methods, both work from one page and not from the other.
Dim PrintCmd as String = "PrintForm.aspx?var1=value&var2=value..."
PrintCmd =  "<script language=javascript> {window.open('" & PrintCmd & "', '_blank');}</script>"
WriteNlog.Info(PrintCmd)
Response.Write(PrintCmd)
CallNlog.Info("Returned from print")

Open in new window

And
Dim PrintCmd as String = "PrintForm.aspx?var1=value&var2=value..."
PrintCmd =  window.open('" & PrintCmd & ")"
WriteNlog.Info(PrintCmd)
ClientScript.RegisterStartupScript(Me.GetType(), "receipt1", PrintCmd, True)
CallNlog.Info("Returned from print")

Open in new window

The CallNlog calls write to the log in all instances.
PrintCmd =  window.open('" & PrintCmd & ")"

Open in new window


should give error...
Yeah, it would have. Wow, that was really not what it started out as.
That wouldn't even have compiled.
It seems I managed to hack most of the end off when I edited it.
I think I was trying to do three things at once. Yeah, that's what it was........
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.