469,890 Members | 1,766 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,890 developers. It's quick & easy.

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 2548
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by SalamElias | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.