TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
jamie_pattison
NA
15
0
Display script as text
Sep 25 2020 1:23 PM
I have 2 web form pages. Page 1 collects user information using text boxes. Page 2 displays the users information entered in page 1. I have a text box on page 1, this collects the users first name and stores in a class property MyClass.Firstname = txtFirstName.Text On page 2 I use a literal control to display the first name litName.Text = MyClass.Firstname; This all is fine but then I test it adding some scripts to the textbox and go to page 2. When I go to page 2 it executes the script but I want it to show it as text and not run the script I tried litName.Text = Server.HtmlEncode(MyClass.Firstname); But this still executes the script. How can i just display this as text? Also if I do encode/decode the text and the user goes back to page 1 if they entered a script tag on page 1 and they go back the text shows as <script> how could I display this back to the correct format. Appreciate if anyone could give me an example to follow.
Reply
Answers (
1
)
assigning 2 textbox in c#
Here i am getting an exception