I'm using rotativa to generate pdf in asp net core 2.0, and it's occurring following error:
"ArgumentNullException: Value cannot be null. Parameter name: view"
I think it happens because rotativa does not accept absolute path to find view. How can i resolve this?
Here is github address of plugin I'm using:
https://github.com/webgio/Rotativa.AspNetCore
You have to set value of property view as below
var rpt = new ViewAsPdf();
rpt.ViewName = "Test";
After this your issue will be resolved
Related
I have an application which uses a SQLite database to store data locally. I get the path to and open the database using:
string dbPath = System.IO.Path.Combine(FileSystem.AppDataDirectory, "mydatabase")
db = new SQLiteConnection(dbPath);
I have created an example database (example.db3) and copied this to the Resources\Raw folder with the Build Action MauiAsset.
My question is how do I get the path to this database file so I can use
string dbPath = System.IO.Path.Combine("*path to Resources\Raw foldder*", "example.db3");
to get the full path to open the example database.
I have tried searching but the best I can get is using FileSystem.Current.OpenAppPackageFileAsync but this opens the file for stream reading whereas I need to get the path.
Ideally the method would work on all platforms.
It is a known issue about this problem.
You can follow it up here: https://github.com/dotnet/maui/issues/3270.
Thanks for your feedback and support.
My problem is simple - the ${appName} property substitution in Config.groovy does not appear to be working for me.
I have a config item called path.to.resources = ${appName}/videos, but when I read that from my controller using grailsApplication.config.path.to.resources, I get ${appName}/videos instead of myAppName/videos.
I'm using Grails 2.0.4 and STS
Try this
path.to.resources = "${appName}/videos"
I start Xamarin Studio 4.0.3 and create a new solution for MonoDroid application. I am targetting version 2.3 or higher. I include Sqlite.cs from the sqlite-net (latest from site) project. I make sure I have a reference to Mono.Data.SQLite in the project. Then in the OnCreate of the default MainActivity I try to use the code shown in the readme to make a database connection:
string path = Android.OS.Environment.DataDirectory.ToString();
string dbname = path + "/" + "test.db3";
var db = new SQLiteConnection(dbname, SQLiteOpenFlags.Create|SQLiteOpenFlags.ReadWrite ,true);
However it always fails with an exception saying it can't open the database. If I follow Greg Shackles example and use SqliteDbHelper method it works, but I would like to understand what I am doing wrong that sqlite-net connection method is not working. I have a feeling I am missing something simple. I did also try just passing in a filename to SQLiteConnection() as well but when it failed I added the OpenFlags to see if that was the issue.
I just found out that apparently you're supposed to use the personal folder, instead of the databases folder:
string folder = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
var db = new SQLiteConnection(Path.Combine(folder, "mydb.db"));
I'm having trouble downloading file with asp.net mvc2. This is how I do it in my download action:
return File(resultBytes, Settings.Default.CsvFileContentType, downloadName);
The problem is with the downloadName, this is how I generate it:
var downloadName = string.Format("{0}_{1}{2}", vModel.CompetitionEvent.Ends.Year, Text.RemoveDiacriticalChars(vModel.Competition.Title), Settings.Default.CsvFileExtension);
and when I debug, downloadName value is: "2011_SS C/C++/Pascal (I.).csv"
but what I get upon downlaod is: "Pascal (I.).csv".
Does anyone have an idea why this happens?
You simply cannot have a "/" character in a filename. Windows filenames in general cannot contain "\/:*?"<>|", so I assume the downloadname is being automatically truncated to adhere to this limitation.
Try replacing the "/" with a hypen ("-") instead, and see what happens :)
How do I obtain the fully qualified path of an isolated storage file for a WPF application?
You can use reflection to do so, as shown in the linked forum post:
IsolatedStorageFileStream oStream =
new IsolatedStorageFileStream(ISOLATED_FILE_NAME, FileMode.Create, isoStore);
// Get the physical path using reflection
String filePath = oStream.GetType().GetField("m_FullPath",
BindingFlags.Instance | BindingFlags.NonPublic).GetValue(oStream).ToString();
Console.WriteLine(filePath);
On Windows 10 Mobile the isolated-storage-path is equal to Windows.Storage.ApplicationData.Current.LocalFolder.
If you know the relative file-path inside the isolated-storage you can use System.IO.Path.Combine() to create the full path.
You can use IsolatedStorageFile.GetUserStoreForApplication().GetFileNames() to list all files in the isolated-storage.