Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6389315
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T03:23:19+00:00 2026-05-25T03:23:19+00:00

i have small class like public static class TSM { static string TokenID =

  • 0

i have small class like

public static class TSM
{

    static string TokenID = "";

    public static string GetTSM()
    {
        TokenID = new Guid().ToString();
        return TokenID;
    }

}

`GetTokenID `will return a string

i just call GetTokenID from my aspx page like

<script language="javascript" type="text/javascript">
    var token= <% =TSM.GetTSM() %>;

i am getting error when i am running that aspx page.

the error is

Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS1002: ; expected

please guide me what is going wrong. thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T03:23:19+00:00Added an answer on May 25, 2026 at 3:23 am

    You need to bring the namespace in which this TSM class is declared into scope in your Web Page:

    <%@ Import Namespace="SomeNamespace" %>
    ...
    <script type="text/javascript">
        var token = '<%=TSM.GetTSM() %>';
    </script>
    

    or fully quote it:

    <script type="text/javascript">
        var token = '<%= SomeNamespace.TSM.GetTSM() %>';
    </script>
    

    or include it in the <namespaces> section of your web.config.

    Remark: Notice the '' around the <%=TSM.GetTSM() %> as there is no Guid type in javascript. You must use a string.

    Also note that your server side code is not thread-safe because of the assignment of this static field. Also it will always generate an empty guid.

    Here’s how to improve it:

    public static class TSM
    {
        public static string GetTSM()
        {
            return Guid.NewGuid().ToString();
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a small class hierarchy where I would like to have a child
I have the following helper class (simplified): public static class Cache { private static
I have a class like the following: class DreamsImagesStore { public $table = 'dreams_images';
I have an Entity like this: public class Category { public int classid {get;set;}
I have small class called 'Call' and I need to store these calls into
I have a small class that displays an alert via Javascript. I am using
I have this small class called City that simply holds some information about a
I have a not-so-small class under development (that it changes often) and I need
I have a small Java test app in Netbeans where the main() class reads
I have a class which has many small functions. By small functions, I mean

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.