Click here to Skip to main content
16,008,075 members
Home / Discussions / C#
   

C#

 
AnswerRe: MIDI, v12.0 questions Pin
13th dimension9-Jul-07 11:35
13th dimension9-Jul-07 11:35 
GeneralRe: MIDI, v12.0 questions Pin
Luc Pattyn9-Jul-07 11:43
sitebuilderLuc Pattyn9-Jul-07 11:43 
AnswerRe: MIDI, v12.0 questions Pin
13th dimension9-Jul-07 14:06
13th dimension9-Jul-07 14:06 
GeneralRe: MIDI, v12.0 questions Pin
Luc Pattyn9-Jul-07 14:31
sitebuilderLuc Pattyn9-Jul-07 14:31 
QuestionFilling a combo Pin
Banjo Ayorinde9-Jul-07 7:57
Banjo Ayorinde9-Jul-07 7:57 
AnswerRe: Filling a combo Pin
Luc Pattyn9-Jul-07 10:34
sitebuilderLuc Pattyn9-Jul-07 10:34 
AnswerRe: Filling a combo Pin
Nouman Bhatti9-Jul-07 20:42
Nouman Bhatti9-Jul-07 20:42 
QuestionXHTML Validation Pin
Ananthalvan9-Jul-07 7:50
Ananthalvan9-Jul-07 7:50 
Hi,
I found that w3 offers validation service which anyone can access it to validate HTML and make XHTML compliant. Basically, the web service allows the user to validate a fragment of html code - basically copying your html code and validating it, validating the html content by uploading the file and specifying the url for validation.

I was able to hit the webservice for valdiating code fragment. I want to upload file for validation. I am not able to achive that even though I use POST as my request method and use multipart/formdata. Can anyone explain why i am not able to upload the file. Below is the piece of code that i had used.
<br />
       HttpWebRequest request = (HttpWebRequest)WebRequest.Create(http://validator.w3.org/check);<br />
       string boundary = new Guid().ToString().Replace("-", "");<br />
       request.ContentType = "multi-part/form-data; boundary=" + boundary;<br />
       request.Method = "POST";<br />
       BinaryWriter oPostData;<br />
<br />
        MemoryStream oPostStream = new MemoryStream();<br />
        oPostData = new BinaryWriter(oPostStream);<br />
        StreamWriter sw = new StreamWriter(oPostStream);<br />
        <br />
        byte[] lcFile;<br />
        <br />
        FileStream loFile = new FileStream(@"C:\testfile.txt", System.IO.FileMode.Open, System.IO.FileAccess.Read);<br />
<br />
        lcFile = new byte[loFile.Length];<br />
        loFile.Read(lcFile, 0, (int)loFile.Length);<br />
        loFile.Close();<br />
<br />
<br />
        oPostData.Write(Encoding.GetEncoding(1252).GetBytes(<br />
                "--" + boundary + "\r\n" + "&output=soap12" + "&verbose=1" +<br />
                "Content-Disposition: form-data; name=\"uploaded_file\" filename=\"" +<br />
                new FileInfo("C:\\testfile.txt").Name + "\"\r\n\r\n"));<br />
<br />
        oPostData.Write(lcFile);<br />
<br />
        oPostData.Write(Encoding.GetEncoding(1252).GetBytes("\r\n"));<br />
<br />
        request.ContentLength = oPostStream.Length;<br />
        using (Stream s = request .GetRequestStream())<br />
            oPostStream.WriteTo(s);<br />
<br />
        oPostData.Close();<br />
<br />
        Thread.Sleep(1000);<br />
<br />
        try<br />
        {<br />
            HttpWebResponse response = (HttpWebResponse)request.GetResponse();<br />
            StreamReader streamReader = new StreamReader(response.GetResponseStream());<br />
            string str = streamReader.ReadToEnd();<br />
<br />
            Response.Write(str);<br />
        }<br />
        catch (WebException ex)<br />
        {<br />
            HttpWebResponse webResoponse = (HttpWebResponse)ex.Response;<br />
            Response.Write(webResoponse.StatusCode);<br />
        }


Thanks

-Ananth
QuestionDeploying a win app with crystal report in .Net 2005 Pin
Banjo Ayorinde9-Jul-07 7:48
Banjo Ayorinde9-Jul-07 7:48 
QuestionChanging Access DB Password Pin
Richard Blythe9-Jul-07 7:24
Richard Blythe9-Jul-07 7:24 
QuestionPassword Length Throws Error Pin
Richard Blythe9-Jul-07 18:47
Richard Blythe9-Jul-07 18:47 
QuestionC# Event logger Pin
Andre da Silva Carrilho9-Jul-07 7:19
Andre da Silva Carrilho9-Jul-07 7:19 
QuestionQuestion on Horizantal Scroller and Client Screen Resolution... Pin
Khoramdin9-Jul-07 6:56
Khoramdin9-Jul-07 6:56 
AnswerRe: Question on Horizantal Scroller and Client Screen Resolution... Pin
Luc Pattyn9-Jul-07 7:26
sitebuilderLuc Pattyn9-Jul-07 7:26 
QuestionWhat is the purpose of suspend and resume layout? i cant see it working Pin
sinosoidal9-Jul-07 5:52
sinosoidal9-Jul-07 5:52 
AnswerRe: What is the purpose of suspend and resume layout? i cant see it working Pin
Luc Pattyn9-Jul-07 6:38
sitebuilderLuc Pattyn9-Jul-07 6:38 
GeneralRe: What is the purpose of suspend and resume layout? i cant see it working Pin
Martin#9-Jul-07 8:53
Martin#9-Jul-07 8:53 
QuestionHelp with reading XML [modified] Pin
velkropie9-Jul-07 5:44
velkropie9-Jul-07 5:44 
AnswerRe: Help with reading XML Pin
Vikram A Punathambekar9-Jul-07 18:19
Vikram A Punathambekar9-Jul-07 18:19 
GeneralRe: Help with reading XML Pin
velkropie10-Jul-07 4:22
velkropie10-Jul-07 4:22 
GeneralRe: Help with reading XML Pin
Vikram A Punathambekar10-Jul-07 4:42
Vikram A Punathambekar10-Jul-07 4:42 
GeneralRe: Help with reading XML [modified] Pin
velkropie10-Jul-07 9:43
velkropie10-Jul-07 9:43 
QuestionExample DataGridView like Outlook... Pin
jsosa99-Jul-07 5:33
jsosa99-Jul-07 5:33 
AnswerRe: Example DataGridView like Outlook... Pin
velkropie11-Jul-07 11:40
velkropie11-Jul-07 11:40 
GeneralRe: Example DataGridView like Outlook... Pin
jsosa911-Jul-07 12:24
jsosa911-Jul-07 12:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.