I am trying to create a new file on the web server by clicking a button on the client page.
Browser console shows only "WASM: File created." but does not show any errors or warnings about the file operations.
There are not any new files under the path /wwwroot either.
Blazor server is running on localhost (Win10) as administrator.
Index.razor content;
@page "/"
<h1>Demo1</h1>
<button type="submit" @onclick="CreateFile.Run">Create A New File</button>
@code
{
public class CreateFile
{
public static void Run()
{
System.IO.File.WriteAllText("test.txt", "hello world");
System.IO.File.WriteAllText(@"C:\VS Code Projects\Demo1\Client\wwwroot\samplefile.txt", "content 123");
Console.WriteLine("File created.");
}
}
}