Note that there are some explanatory texts on larger screens.

plurals
  1. POASP.NET code will not run, getting error: The resource cannot be found
    text
    copied!<p>I have got the following code, I wish to simply load the page in my browser running it with IIS 7. </p> <pre><code>&lt;%@ Page Language="C#" Debug="true" %&gt; &lt;% using System; protected string callRotate() { ProcessStartInfo info = new ProcessStartInfo(); string[] arguments = { "arg1" , "arg2" }; info.FileName = "ConsoleApplication1"; Process process = Process.Start(info.FileName, arguments); Process.Start(info); } %&gt; </code></pre> <p>Here is the error I get in the browser:</p> <pre><code> Server Error in '/' Application. Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. Compiler Error Message: CS1513: } expected Source Error: Line 1: &lt;%@ Page Language="C#" Debug="true" %&gt; Line 2: &lt;% Line 3: using System; Line 4: Line 5: protected string callRotate() Source File: c:\inetpub\wwwroot\testing\testing.aspx Line: 3 </code></pre> <p><strong>Update 1:</strong> Now i'm getting this error:</p> <pre><code>Compiler Error Message: CS1519: Invalid token 'using' in class, struct, or interface member declaration Source Error: Line 1: &lt;%@ Page Language="C#" Debug="true" %&gt; Line 2: &lt;script runat="server"&gt; Line 3: using System; Line 4: Line 5: protected string callRotate() </code></pre> <p><strong>Update 2:</strong></p> <p>Error:</p> <pre><code>Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. Compiler Error Message: CS0246: The type or namespace name 'ProcessStartInfo' could not be found (are you missing a using directive or an assembly reference?) Source Error: Line 5: protected string callRotate() Line 6: { Line 7: ProcessStartInfo info = new ProcessStartInfo(); Line 8: string[] arguments = { "arg1" , "arg2" }; Line 9: info.FileName = "ConsoleApplication1"; Source File: c:\inetpub\wwwroot\testing\testing.aspx Line: 7 </code></pre> <p>And here is the code:</p> <pre><code>&lt;%@ Page Language="C#" Debug="true" %&gt; &lt;%@ Import Namespace="System" %&gt; &lt;script runat="server"&gt; protected string callRotate() { ProcessStartInfo info = new ProcessStartInfo(); string[] arguments = { "arg1" , "arg2" }; info.FileName = "ConsoleApplication1"; Process process = Process.Start(info.FileName, arguments); Process.Start(info); } &lt;/script&gt; </code></pre> <p><strong>Update 3:</strong> Ah okay, previously I switched to using a command line application as I couldn't get any of this code to work in the browser, but now you have shown me how I can switch back to running it in browser. </p> <p>So I have taken my application and converted it to work in the browser and everything is fine. But how do I go about fetching url variables? </p> <p>I know it's something to do with Request.QueryString but that won't work and I have added the following line:</p> <p>Current code:</p> <pre><code>&lt;%@ Page Language="C#" Debug="true" %&gt; &lt;%@ Import Namespace="System" %&gt; &lt;%@ Import Namespace="System.Drawing" %&gt; &lt;%@ Import Namespace="System.Web" %&gt; &lt;script runat="server"&gt; static void Main(string[] args) { string url = Request.QueryString["url"]; string rotate_dir = Request.QueryString["dir"]; //create an image object from the image in that path System.Drawing.Image img = System.Drawing.Image.FromFile(url); //Rotate the image in memory if (direction == "clockwise") { //Rotate clockwise img.RotateFlip(RotateFlipType.Rotate90FlipNone); } else if (direction == "anticlockwise") { //Rotate anti-clockwise img.RotateFlip(RotateFlipType.Rotate90FlipXY); } //Delete the file so the new image can be saved System.IO.File.Delete(url); //save the image to the file img.Save(url); //release image file img.Dispose(); } &lt;/script&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload