none
Error accessing a variable using javascript in code behind RRS feed

  • Question

  • I am using VS2017 and using C# in code behind. I am using javascript within code behind and attempting to send a value to the script using a variable that contains a url that is pulled from a web service. I cannot seem to get it to work. I am getting an error message " JavaScript runtime error: 'urlstr1' is undefined occurred". See code below. What am I doing wrong?

    var urlstr1 = Application["FacUrl"].ToString();
    Response.Write("<script type='text/javascript'>"  +
                           "var child = window.open(urlstr1 , '-blank' );" +
                           "setTimeout(function(){child.close();}, 10000);" +
                           "</script>");

      
    Monday, April 23, 2018 4:08 PM

All replies

  • Hi J-Bal,

    Welcome to the MSDN forum.

    It seems your issue is about the ASP.NET development, since our forum is to discuss the VS IDE, please redirect to this appropriate forum: https://forums.asp.net/ and start a new thread for a better support, thank you for your understanding.

    Best regards,

    Sara


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    Tuesday, April 24, 2018 5:33 AM