473,385 Members | 1,730 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Dynamically creating a .js file to be included in response

I am creating a custom web control that uses an enum for a property
{Remote,InLine}.
If the property is set to inline then text is read from the embedded
resource and sent to the browser in the aspx page as inline java script.
If the property is set to Remote then the script tag set with the SRC
attribute is displayed <script language="javascript"
Src="MyJS.js"></script>.

Is there a way to catch an incoming request from the browser (for the
<script language="javascript" src="myJavaScript.js"></script>
And then dynamically create the file before it returns a response to the
browser that the file does not exsit
Thanks,
Ron.
Nov 17 '05 #1
10 2707
Hi,

Sleight of hand: specify an aspx file in the SRC attribute of the SCRIPT tag
and generate the script on the fly in this aspx file.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"Ron Vecchi" <rv*****@xilehdvecchi.com> wrote in message
news:eE**************@TK2MSFTNGP09.phx.gbl...
I am creating a custom web control that uses an enum for a property
{Remote,InLine}.
If the property is set to inline then text is read from the embedded
resource and sent to the browser in the aspx page as inline java script.
If the property is set to Remote then the script tag set with the SRC
attribute is displayed <script language="javascript"
Src="MyJS.js"></script>.

Is there a way to catch an incoming request from the browser (for the
<script language="javascript" src="myJavaScript.js"></script>
And then dynamically create the file before it returns a response to the
browser that the file does not exsit
Thanks,
Ron.


Nov 17 '05 #2
Hi,

Sleight of hand: specify an aspx file in the SRC attribute of the SCRIPT tag
and generate the script on the fly in this aspx file.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"Ron Vecchi" <rv*****@xilehdvecchi.com> wrote in message
news:eE**************@TK2MSFTNGP09.phx.gbl...
I am creating a custom web control that uses an enum for a property
{Remote,InLine}.
If the property is set to inline then text is read from the embedded
resource and sent to the browser in the aspx page as inline java script.
If the property is set to Remote then the script tag set with the SRC
attribute is displayed <script language="javascript"
Src="MyJS.js"></script>.

Is there a way to catch an incoming request from the browser (for the
<script language="javascript" src="myJavaScript.js"></script>
And then dynamically create the file before it returns a response to the
browser that the file does not exsit
Thanks,
Ron.


Nov 17 '05 #3
One problem with that is that now I would need to have an aspx file along
with my custom control.
I have recently caught notice of HttpHandlers but really don't know what
they are or how to use them.


"Dmitriy Lapshin [C# / .NET MVP]" <x-****@no-spam-please.hotpop.com> wrote
in message news:ev**************@TK2MSFTNGP09.phx.gbl...
Hi,

Sleight of hand: specify an aspx file in the SRC attribute of the SCRIPT tag and generate the script on the fly in this aspx file.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"Ron Vecchi" <rv*****@xilehdvecchi.com> wrote in message
news:eE**************@TK2MSFTNGP09.phx.gbl...
I am creating a custom web control that uses an enum for a property
{Remote,InLine}.
If the property is set to inline then text is read from the embedded
resource and sent to the browser in the aspx page as inline java script.
If the property is set to Remote then the script tag set with the SRC
attribute is displayed <script language="javascript"
Src="MyJS.js"></script>.

Is there a way to catch an incoming request from the browser (for the
<script language="javascript" src="myJavaScript.js"></script>
And then dynamically create the file before it returns a response to the
browser that the file does not exsit
Thanks,
Ron.

Nov 17 '05 #4
One problem with that is that now I would need to have an aspx file along
with my custom control.
I have recently caught notice of HttpHandlers but really don't know what
they are or how to use them.


"Dmitriy Lapshin [C# / .NET MVP]" <x-****@no-spam-please.hotpop.com> wrote
in message news:ev**************@TK2MSFTNGP09.phx.gbl...
Hi,

Sleight of hand: specify an aspx file in the SRC attribute of the SCRIPT tag and generate the script on the fly in this aspx file.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"Ron Vecchi" <rv*****@xilehdvecchi.com> wrote in message
news:eE**************@TK2MSFTNGP09.phx.gbl...
I am creating a custom web control that uses an enum for a property
{Remote,InLine}.
If the property is set to inline then text is read from the embedded
resource and sent to the browser in the aspx page as inline java script.
If the property is set to Remote then the script tag set with the SRC
attribute is displayed <script language="javascript"
Src="MyJS.js"></script>.

Is there a way to catch an incoming request from the browser (for the
<script language="javascript" src="myJavaScript.js"></script>
And then dynamically create the file before it returns a response to the
browser that the file does not exsit
Thanks,
Ron.

Nov 17 '05 #5
Ron,

In case of Http handlers I beleive you'll still have to have an additional
handler file (don't remember its extension) - or at least modify the
application's web.config file to register the handler.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"Ron Vecchi" <rv*****@xilehdvecchi.com> wrote in message
news:uD*************@TK2MSFTNGP10.phx.gbl...
One problem with that is that now I would need to have an aspx file along
with my custom control.
I have recently caught notice of HttpHandlers but really don't know what
they are or how to use them.


"Dmitriy Lapshin [C# / .NET MVP]" <x-****@no-spam-please.hotpop.com> wrote
in message news:ev**************@TK2MSFTNGP09.phx.gbl...
Hi,

Sleight of hand: specify an aspx file in the SRC attribute of the SCRIPT

tag
and generate the script on the fly in this aspx file.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"Ron Vecchi" <rv*****@xilehdvecchi.com> wrote in message
news:eE**************@TK2MSFTNGP09.phx.gbl...
I am creating a custom web control that uses an enum for a property
{Remote,InLine}.
If the property is set to inline then text is read from the embedded
resource and sent to the browser in the aspx page as inline java script. If the property is set to Remote then the script tag set with the SRC
attribute is displayed <script language="javascript"
Src="MyJS.js"></script>.

Is there a way to catch an incoming request from the browser (for the
<script language="javascript" src="myJavaScript.js"></script>
And then dynamically create the file before it returns a response to the browser that the file does not exsit
Thanks,
Ron.



Nov 17 '05 #6
Ron,

In case of Http handlers I beleive you'll still have to have an additional
handler file (don't remember its extension) - or at least modify the
application's web.config file to register the handler.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"Ron Vecchi" <rv*****@xilehdvecchi.com> wrote in message
news:uD*************@TK2MSFTNGP10.phx.gbl...
One problem with that is that now I would need to have an aspx file along
with my custom control.
I have recently caught notice of HttpHandlers but really don't know what
they are or how to use them.


"Dmitriy Lapshin [C# / .NET MVP]" <x-****@no-spam-please.hotpop.com> wrote
in message news:ev**************@TK2MSFTNGP09.phx.gbl...
Hi,

Sleight of hand: specify an aspx file in the SRC attribute of the SCRIPT

tag
and generate the script on the fly in this aspx file.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"Ron Vecchi" <rv*****@xilehdvecchi.com> wrote in message
news:eE**************@TK2MSFTNGP09.phx.gbl...
I am creating a custom web control that uses an enum for a property
{Remote,InLine}.
If the property is set to inline then text is read from the embedded
resource and sent to the browser in the aspx page as inline java script. If the property is set to Remote then the script tag set with the SRC
attribute is displayed <script language="javascript"
Src="MyJS.js"></script>.

Is there a way to catch an incoming request from the browser (for the
<script language="javascript" src="myJavaScript.js"></script>
And then dynamically create the file before it returns a response to the browser that the file does not exsit
Thanks,
Ron.



Nov 17 '05 #7
Hi Ron,

Firstly I wan to thank Dmitriy for this great help in this issue.

Based on my research and experience, we need not to create our own
httphandler or httpmoudle in this case. As my opinion, since we know when
the enum propery is equal to Remote,InLine or when it equal to another
value, we can decide whether we need to generate the js file at that time
on the fly.

If I have misunderstood your concern, please feel free to let me know.

Best regards,

Jacob Yang
Microsoft Online Partner Support
Get Secure! ¨C www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 17 '05 #8
Hi Ron,

Firstly I wan to thank Dmitriy for this great help in this issue.

Based on my research and experience, we need not to create our own
httphandler or httpmoudle in this case. As my opinion, since we know when
the enum propery is equal to Remote,InLine or when it equal to another
value, we can decide whether we need to generate the js file at that time
on the fly.

If I have misunderstood your concern, please feel free to let me know.

Best regards,

Jacob Yang
Microsoft Online Partner Support
Get Secure! ¨C www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 17 '05 #9
Yes, It took me a little while to think through it but since the enum is
known I basically check for it and then create a directory and the .js file
on the server and render my control with the <Script> tag either with the
src attribute pointed to the newly created file or with the tag and
javascript all togeather on the page.

Thanks
"Jacob Yang [MSFT]" <ji***@online.microsoft.com> wrote in message
news:Yp**************@cpmsftngxa06.phx.gbl...
Hi Ron,

Firstly I wan to thank Dmitriy for this great help in this issue.

Based on my research and experience, we need not to create our own
httphandler or httpmoudle in this case. As my opinion, since we know when
the enum propery is equal to Remote,InLine or when it equal to another
value, we can decide whether we need to generate the js file at that time
on the fly.

If I have misunderstood your concern, please feel free to let me know.

Best regards,

Jacob Yang
Microsoft Online Partner Support
Get Secure! ¨C www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 17 '05 #10
Yes, It took me a little while to think through it but since the enum is
known I basically check for it and then create a directory and the .js file
on the server and render my control with the <Script> tag either with the
src attribute pointed to the newly created file or with the tag and
javascript all togeather on the page.

Thanks
"Jacob Yang [MSFT]" <ji***@online.microsoft.com> wrote in message
news:Yp**************@cpmsftngxa06.phx.gbl...
Hi Ron,

Firstly I wan to thank Dmitriy for this great help in this issue.

Based on my research and experience, we need not to create our own
httphandler or httpmoudle in this case. As my opinion, since we know when
the enum propery is equal to Remote,InLine or when it equal to another
value, we can decide whether we need to generate the js file at that time
on the fly.

If I have misunderstood your concern, please feel free to let me know.

Best regards,

Jacob Yang
Microsoft Online Partner Support
Get Secure! ¨C www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 17 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Raghuram Banda | last post by:
Hi all, I've created a table with Table Header and the table may or may not contain any rows initially. I've included a .css file in <head> section of my HTML script and I'm creating rows to...
0
by: Ron Vecchi | last post by:
I am creating a custom web control that uses an enum for a property {Remote,InLine}. If the property is set to inline then text is read from the embedded resource and sent to the browser in the...
2
by: Patrick | last post by:
I want to define a set of web-form templates in XML and render the equivalent web-form with ASP.NET, then process any input server controls on the form. Reading the XML file from Page_load is...
3
by: Dotnet Gruven | last post by:
I've built a WebForm with a Table added dynamically in Page_Load when IsPostBack is false. The table includes a couple of TextBoxes, RadioButtonLists and CheckboxLists. On postback, those...
7
by: andym | last post by:
Dear All, I wish to have an ASP page that displays a predetermined date in the middle of a string. I wish this date to be set in a seperate control panel type page. I am hoping somebody could...
5
by: SalamElias | last post by:
I am creating several chkBoxes dynamically and assigning an event handler in the Page_load as foillows ***************************** Dim chkCatOption As CheckBox = New CheckBox chkCatOption.Text...
0
by: Syoam4ka | last post by:
My project is about jewellery. I have devided my jewelery into main types, which each one of them has sub types, and each one those sub types has the jewellery. I have a tabcontainer. It includes...
3
by: MLD | last post by:
PLEASE HELP! I would like to include a UL as a menu, styled by an included CSS Style Sheet. The problem I am having is how do I dynamically set the "active" page class using JavaScript to...
7
by: RichB | last post by:
I am trying to get to grips with the asp.net ajaxcontrol toolkit, and am trying to add a tabbed control to the page. I have no problems within the aspx file, and can dynamically manipulate a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
Oralloy
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,...
0
jinu1996
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 using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.