How do I convert HTML string to a file so that I can put it in an iframe?

I'm continuing work on my WebMonitor project, and I've made decent progress. Context ->

Now I have a working prototype here ->

It's very rough, no error handling etc. but it does work. You can try it out by putting in

You'll see that it shows you the changed text, nicely highlighted and all.

However, I'm running into a problem and I'd like some help.


WebPage Class – >

Home Controller ->

Index View ->

The Home Controller checks to see if the webpage has changed from what's stored in the DB. If it has, it renders a diff and sends the HTML text as a long string of HTML to the Index view.

The view then renders the HTML text as HTML.

The problem is, since it's not in an iframe, the page CSS breaks if there's a conflict. Try putting in and you'll see what I mean.

I can see that putting the text in an iframe would work fine, but how do I create an ephemeral HTML file, link to that in the iframe, and then destroy it later?

I thought of storing the HTML source in the DB as a binary object, but even then, how do I create a temporary HTML file that lives on the drive, and then gets destroyed after the user exits the page?

Any other ideas that I should look into? If it helps, I'm trying to expand my C# knowledge by building a very simple copy of A service that lets you put in a single URL, stores the HTML in a database, and then you can check to see what's changed.

I may not be explaining myself properly (I'm a beginner). Please tell me if this doesn't make sense and I'll be happy to elucidate.


by WhosListening via /r/csharp

URGENT! Need C# Help for Unity2D puzzle programming!!!

Hi all. I'm making a video game for my class and it's the final few hours before everything due! I'm having one issue with C# and it's figuring how to code a puzzle. The scene is set up with three switches. After turning the first switch on, the second switch on then off and leaving the third switch off, the door opens. I'm not sure how to code this and have been busy writing other codes since. If anyone can help, not even by giving me the code but telling me a solution, much would be appreciated!!

by oqqas via /r/csharp

Databinding and background worker w/WinForms

I'm currently trying to learn C# and I'm running into some strange problems when trying to multithread my app.

In tweetStreamViewModel.cs (Ignore the name, I know I'm not implementing MVVM correctly here) I'm using a background worker to gather tweets from Twitter's streaming API (using TweetINVI.) I wanted to update the UI ( a textbox ) asynchronously with the bw.ReportProgress by updating a property the textbox has a databinding to.

The tweetStreamViewModel object was instantiated on the GUI thread and I can access the newTweet property just fine, but when the PropertyChanged event is raised it throws 'System.InvalidOperationException' stating that {"Cross-thread operation not valid: Control 'textBox1' accessed from a thread other than the thread it was created on."}

Sorry if my terminology is off, not really sure what I'm doing :(

by teknorath via /r/csharp

For PluralSight users: Suggest me a learning path for Visual Studio / C#.

Hello guys ! I just grabbed my 6 month pluralsight subscription and Im looking for some sequence on learning C# basics and Visual Studio.

Just in general lines, I developed as a full time developer for 3 years until 4 years ago but I just followed the companie's best pactices that they used that time and well.. I want to get in touch with the market right now but I want to get everything from scratch, so I will be sure that some structures and possibilities wont be missed.

I have already dealed with MVC framework and furthermore I will look for this but I want to start from scratch.

Could you list me the most indicated courses to start there ? There as too many options and I have found some with almost the same subject.

by Daniel-sp via /r/csharp

An in depth tutorial for c# errorProvider?

Hi all, I'm trying to use the visual c# error provider component but haven't been able to find a tutorial for what wanted to do. I was hoping you'd be able to help.

I have about a dozen text boxes, and when I press a button I need the error to show only for the boxes that are empty, and (if possible) in some boxes if the input is not numeric.

I also need the error to disappear only on the boxes which have correct info. At the moment, all I have is errorProvider1.Clear(). Which is not great.

Do I need to create a different errorProvider component for each textbox?


by freakzilla149 via /r/csharp

Json Array within Json Array Serializer Help [UWP]

Really new to Json and i can't find many examples of working with Json arrays within Json arrays. This is the Json.

[{ "Country": 11, "States": [{ "Cities": 72689442 }] }] 

and this is the my classes from them

 public class Rootobject { public int Country { get; set; } public List<State> States { get; set; } } public class State { public int Cities { get; set; } } 

How would i go ahead with Serializing or Deserilaizing to get the objects to work

by InstanceGG via /r/csharp