Hi,
I'm trying to build an .ASPX file that returns the contents of a .js file,
so that I can use:
<script language="JavaScript" src="/mypage.aspx"
type="text/javascript"></script>
Even when disabling viewstate etc I still end up with ASP.NET returning
contents as set with
Response.Write("var test=12;") in the PageOnLoad I end up with this extra
HTML code:
Thanks,
Wim
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>page4</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form method="post" action="page4.aspx" id="Form1">
<div>
<input type="hidden" name="__VIEWSTATE"
value="/wEPDwUKLTUxMTcwNzgxMGRkPbcvOzDy6UopR2KGJnAsry/0lgY=" />
</div>
</form>
</body>
</HTML> 5 1386
2 ways to get rid of that, that I can think of:
1) Remove all that stuff from the .aspx doing the generation. So leave only
the @Page directive. Since all that stuff is there in the .aspx, it
automatically becomes part of the response.
2) Try a Response.Clear before your .aspx starts Response.Write'ing its
javascript contents.
"WL" <no****@nospam.nospam> wrote in message
news:ez*************@tk2msftngp13.phx.gbl... Hi,
I'm trying to build an .ASPX file that returns the contents of a .js file, so that I can use:
<script language="JavaScript" src="/mypage.aspx" type="text/javascript"></script>
Even when disabling viewstate etc I still end up with ASP.NET returning contents as set with Response.Write("var test=12;") in the PageOnLoad I end up with this extra HTML code:
Thanks,
Wim
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > <HTML> <HEAD> <title>page4</title> <meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1"> <meta name="CODE_LANGUAGE" Content="C#"> <meta name="vs_defaultClientScript" content="JavaScript"> <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5"> </HEAD> <body MS_POSITIONING="GridLayout"> <form method="post" action="page4.aspx" id="Form1"> <div> <input type="hidden" name="__VIEWSTATE" value="/wEPDwUKLTUxMTcwNzgxMGRkPbcvOzDy6UopR2KGJnAsry/0lgY=" /> </div>
</form> </body> </HTML>
Response.Clear does not work because the ASP.NET stuff is added AFTERWARDs.
Meanwhile I found I out you can do this in the page.obload, after having set
the response.content:
Response.End()
Wim
"Marina" <so*****@nospam.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl... 2 ways to get rid of that, that I can think of:
1) Remove all that stuff from the .aspx doing the generation. So leave
only the @Page directive. Since all that stuff is there in the .aspx, it automatically becomes part of the response. 2) Try a Response.Clear before your .aspx starts Response.Write'ing its javascript contents.
"WL" <no****@nospam.nospam> wrote in message news:ez*************@tk2msftngp13.phx.gbl... Hi,
I'm trying to build an .ASPX file that returns the contents of a .js
file, so that I can use:
<script language="JavaScript" src="/mypage.aspx" type="text/javascript"></script>
Even when disabling viewstate etc I still end up with ASP.NET returning contents as set with Response.Write("var test=12;") in the PageOnLoad I end up with this
extra HTML code:
Thanks,
Wim
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > <HTML> <HEAD> <title>page4</title> <meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1"> <meta name="CODE_LANGUAGE" Content="C#"> <meta name="vs_defaultClientScript" content="JavaScript"> <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5"> </HEAD> <body MS_POSITIONING="GridLayout"> <form method="post" action="page4.aspx" id="Form1"> <div> <input type="hidden" name="__VIEWSTATE" value="/wEPDwUKLTUxMTcwNzgxMGRkPbcvOzDy6UopR2KGJnAsry/0lgY=" /> </div>
</form> </body> </HTML>
Ok yes, good point, you would not need to clear what was already there - but
only make sure that nothing else got written out.
"WL" <no****@nospam.nospam> wrote in message
news:%2***************@TK2MSFTNGP09.phx.gbl... Response.Clear does not work because the ASP.NET stuff is added
AFTERWARDs. Meanwhile I found I out you can do this in the page.obload, after having
set the response.content:
Response.End()
Wim
"Marina" <so*****@nospam.com> wrote in message news:%2****************@TK2MSFTNGP11.phx.gbl... 2 ways to get rid of that, that I can think of:
1) Remove all that stuff from the .aspx doing the generation. So leave only the @Page directive. Since all that stuff is there in the .aspx, it automatically becomes part of the response. 2) Try a Response.Clear before your .aspx starts Response.Write'ing its javascript contents.
"WL" <no****@nospam.nospam> wrote in message news:ez*************@tk2msftngp13.phx.gbl... Hi,
I'm trying to build an .ASPX file that returns the contents of a .js file, so that I can use:
<script language="JavaScript" src="/mypage.aspx" type="text/javascript"></script>
Even when disabling viewstate etc I still end up with ASP.NET
returning contents as set with Response.Write("var test=12;") in the PageOnLoad I end up with this extra HTML code:
Thanks,
Wim
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > <HTML> <HEAD> <title>page4</title> <meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1"> <meta name="CODE_LANGUAGE" Content="C#"> <meta name="vs_defaultClientScript" content="JavaScript"> <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5"> </HEAD> <body MS_POSITIONING="GridLayout"> <form method="post" action="page4.aspx" id="Form1"> <div> <input type="hidden" name="__VIEWSTATE" value="/wEPDwUKLTUxMTcwNzgxMGRkPbcvOzDy6UopR2KGJnAsry/0lgY=" /> </div>
</form> </body> </HTML>
Marina,
I just found it: how stupid of me: really your option 1 is the solution. I
was so much under the impression of Dotnet generating all kind of code for
me automatically that I forgot that the code I wanted to get rid of was just
inside my .aspx file.
My sincere apologies for my stupidity ;-)
Wim
"Marina" <so*****@nospam.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl... 2 ways to get rid of that, that I can think of:
1) Remove all that stuff from the .aspx doing the generation. So leave
only the @Page directive. Since all that stuff is there in the .aspx, it automatically becomes part of the response. 2) Try a Response.Clear before your .aspx starts Response.Write'ing its javascript contents.
"WL" <no****@nospam.nospam> wrote in message news:ez*************@tk2msftngp13.phx.gbl... Hi,
I'm trying to build an .ASPX file that returns the contents of a .js
file, so that I can use:
<script language="JavaScript" src="/mypage.aspx" type="text/javascript"></script>
Even when disabling viewstate etc I still end up with ASP.NET returning contents as set with Response.Write("var test=12;") in the PageOnLoad I end up with this
extra HTML code:
Thanks,
Wim
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > <HTML> <HEAD> <title>page4</title> <meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1"> <meta name="CODE_LANGUAGE" Content="C#"> <meta name="vs_defaultClientScript" content="JavaScript"> <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5"> </HEAD> <body MS_POSITIONING="GridLayout"> <form method="post" action="page4.aspx" id="Form1"> <div> <input type="hidden" name="__VIEWSTATE" value="/wEPDwUKLTUxMTcwNzgxMGRkPbcvOzDy6UopR2KGJnAsry/0lgY=" /> </div>
</form> </body> </HTML>
I do this frequently in my code. In fact, I dynamically generate my
includes and reference them that way.
What you do is clear everything in your aspx file except the page directive.
Then, in the code behind, add the following line:
Response.AddHeader("text/javascript");
.... // emit the script
Response.End();
That should do.
Thanks,
Shawn http://www.zenofdotnet.com
"WL" <no****@nospam.nospam> wrote in message
news:ez*************@tk2msftngp13.phx.gbl... Hi,
I'm trying to build an .ASPX file that returns the contents of a .js file, so that I can use:
<script language="JavaScript" src="/mypage.aspx" type="text/javascript"></script>
Even when disabling viewstate etc I still end up with ASP.NET returning contents as set with Response.Write("var test=12;") in the PageOnLoad I end up with this extra HTML code:
Thanks,
Wim
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > <HTML> <HEAD> <title>page4</title> <meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1"> <meta name="CODE_LANGUAGE" Content="C#"> <meta name="vs_defaultClientScript" content="JavaScript"> <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5"> </HEAD> <body MS_POSITIONING="GridLayout"> <form method="post" action="page4.aspx" id="Form1"> <div> <input type="hidden" name="__VIEWSTATE" value="/wEPDwUKLTUxMTcwNzgxMGRkPbcvOzDy6UopR2KGJnAsry/0lgY=" /> </div>
</form> </body> </HTML>
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: daniele.balducci |
last post by:
Hi All,
I'm generating XLS files from ASP(.Net) code using the usual code
chunks ...
Response.ContentType = "application/vnd.ms-excel"
Response.AppendHeader("Content-Disposition", "attachment;...
|
by: manas589 |
last post by:
Hi
Can any one tell me how to use binding.xml while generating castor bean from an xsd file.
i have one xsd file where two element are conflicting. so i thought to use binding file while...
|
by: Nathan Sokalski |
last post by:
Visual Studio 2005 recently stopped generating the *.designer.vb files for
my *.aspx and *.ascx files. I am using Service Pack 1, and do not believe I
did anything differently than normal prior to...
|
by: csharpula csharp |
last post by:
Hello,
I need to generate cs files from XSD files. I would like to do it
automatically. What is the best way to do it? Is it better be done with
PreBuild inside VS (before compilation) or to...
|
by: nuttynibbles |
last post by:
hi, im creating a mobile apps whereby if i transfer a file from a PC to a folder directory in the windows mobile phone, it will detect and fire an event? for example, rename each file that is...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
| |