Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

// What am I not seeing here?

 

StreamReader sr = new StreamReader("template.html");

string templateMain = sr.ReadToEnd().ToString();

sr.Close();

 

// I've tried both ways below, either way nothing happens when I view templateMain

 

templateMain.Replace("<!-- %%HTMLTITLE%% -->","OIN Intranet");

templateMain = Regex.Replace(templateMain, "<!-- %%HTMLTITLE%% -->", "ON Intranet");

Experience is something you don't get until just after the moment you needed it
Posted

Even when I create a new string, it doesn't contain the change.

 

string newTemplateMain = templateMain.Replace("<!-- %%HTMLTITLE%% -->","OIN Intranet");

Response.Write(newTemplateMain);

 

 

PS: When I view the HTML source I specifically know <!-- %%HTMLTITLE%% --> is in there, heck, I copied it from the file and pasted it into my code.

Experience is something you don't get until just after the moment you needed it
Posted

Make sure there's the right amount of "space" in it. A space over and you're not matching.

 

Gimme news

"If someone say : "Die mortal !"... don't stay to see if he isn't." - Unknown

"Learning to program is like going out with a new girl friend. There's always something that wasn't mentioned in the documentation..." - Me

"A drunk girl is like an animal... it scream at everything like a cat and roll in the grass like a dog." - Me after seeing my girlfriend drunk and some of her drunk friend.

C# TO VB TRANSLATOR

Posted
As I said in my previous post.. I copied the text from the .html file (which I made by hand) so it's EXACT.
Experience is something you don't get until just after the moment you needed it
Posted

You might use the replace function as PlausiblyDamp used it.

If it don't work... make sure your templateMain as been filled correctly.

"If someone say : "Die mortal !"... don't stay to see if he isn't." - Unknown

"Learning to program is like going out with a new girl friend. There's always something that wasn't mentioned in the documentation..." - Me

"A drunk girl is like an animal... it scream at everything like a cat and roll in the grass like a dog." - Me after seeing my girlfriend drunk and some of her drunk friend.

C# TO VB TRANSLATOR

Posted

Actually my code paste was a typo and I was trying templateMain = templateMain.Replace....

 

I also tried

 

string newTemplateMain = templateMain.Replace....

 

Ther's something really bizarre going on here.

Experience is something you don't get until just after the moment you needed it
Posted

AH HA

 

Egg in my face, it seems my coworker had the wrong string names so the replace was being performed on the wrong data.

 

Guess next time I should check the contents of my string and not assume it actually contains what I thought.

 

ahhh, debugging.

Experience is something you don't get until just after the moment you needed it

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...