2014-12-10 4 views
1

Matt Groves가 개발 한 YARTE editor에서 작업하는 WYSIWYG 편집기로 WebControl을 사용하여 Winforms .NET 4.0 프로젝트에서 개발 중입니다. 내가 앵커 태그를 추가하고 다음 경로에 href 속성 설정하려고Winforms WebControl - 어떻게 링크를 벗어날 수 있습니까?

: 나는 여러 가지 방법을 시도

var path = http://someurl.aspx?param1="val1"&param2="val2"&param3="youGetTheIdea" 

을; 나는 실패 봤어

http://someurl.aspx?param1="this"&param2="doesnt"&param3="work" 

접근을 :

  1. 은 링크

    webBrowser.ExecCommand("CreateLink", false, path) 
    
  2. 만들기 내가 문서에 URL을 작성하려고 할 때 나는 항상 HTML 이스케이프 앰퍼샌드를 얻을 수

    HTML 만들기 및 붙여 넣기 :

  3. 파일을 생성하고 그것에 웹 브라우저 감독 :

    // assume the links are already inserted, but aren't right. 
    var textWithBadLinks = webBrowser.DocumentText; 
    var betterText = UseRegexToReplaceBadLinkText(textWithBadLinks); 
    using (StreamWriter outfile =new StreamWriter(@"c:\test.html")) 
    { 
        outfile.Write(betterText); 
    } 
    webBrowser.Url= new Uri(@"c:\test.html"); 
    
  4. 이 스트림을 생성하고 그것에 웹 브라우저 감독 :

    // same as above, but instead of the URL, use the DocumentStream: 
    webBrowser.DocumentStream = new StreamWriter(@c:\test.html); 
    
  5. 파일을 탐색 :

    webBrowser.Navigate(new Uri(@"c:\test.html")) 
    

접근 방식에 관계없이을 선택하면 앰퍼샌드가 이스케이프 처리되어 링크가 작동하지 않습니다.

도움을 주셔서 감사합니다.

+0

따라서 &는 &의 인코딩입니까? 기술적으로 말하자면, XHTML은 & amp가 유효해야한다고 생각합니다. 참조하십시오 : http://stackoverflow.com/questions/275150/xhtml-and-ampersand-encoding –

+1

@mgroves - 당신이 맞아 보이는 것 - 당신이 대답을 게시 할 수 있도록 받아 들일 수 있습니까? –

답변