VNS.Umbraco
3.0.12
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package VNS.Umbraco --version 3.0.12
NuGet\Install-Package VNS.Umbraco -Version 3.0.12
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="VNS.Umbraco" Version="3.0.12" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add VNS.Umbraco --version 3.0.12
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: VNS.Umbraco, 3.0.12"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install VNS.Umbraco as a Cake Addin #addin nuget:?package=VNS.Umbraco&version=3.0.12 // Install VNS.Umbraco as a Cake Tool #tool nuget:?package=VNS.Umbraco&version=3.0.12
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
VNS Umbraco
Some diffrent helper tools for Umbraco Core
Installation
Use the package manager nuget to install.
dotnet add package VNS.Umbraco
Intro
First things first, with this package, we added a custom composer that enables direct URL acces to a template
public void Compose(IUmbracoBuilder builder) {
builder.ContentFinders().Clear();
builder.ContentFinders()
.Append<ContentFinderByPageIdQuery>()
.Append<ContentFinderByUrl>()
.Append<ContentFinderByIdPath>()
// Add the url and template one back in here
.Append<ContentFinderByUrlAndTemplate>()
.Append<ContentFinderByUrlAlias>()
.Append<ContentFinderByRedirectUrl>();
}
Init
Add this to the top of you template
// Using
@using VNS.Umbraco;
// For injection
@inject VNS.Umbraco.Helper _vns;
Util (Utility)
This contains a lot of diffrent small static methods to help you create simple code
// Get httpcontext
HttpContext Util.ctx;
// Get appsettings (Will load from appsettings.json)
IConfigurationRoot Util.AppSettings;
// Get connectionstring (Will return connectionstring named umbracoDbDSN)
string Util.ConnectionString;
// Get smtp (Will return from Umbraco:CMS:Global:Smtp)
IConfigurationSection Util.Smtp;
// Get request method
string Util.ReqMethod;
// Is request method post
bool Util.IsPost;
// Get current url
string Util.GetCurrentUrl(bool includePath = true, bool includeQueryString = false);
// Request from form/querystring
string Util.Req(string name);
// Url Encode/Decode
string Util.UrlEncode(string value);
string Util.UrlDecode(string value);
// Html Encode/Decode
string Util.HtmlEncode(string value);
string Util.HtmlDecode(string value);
// Write to body
void Util.Write(object message);
// Redirect
void Util.Redirect(string url);
// Set content type - Default is set to: application/json
void Util.SetContentType(string contentType);
// Check if dynamic object contains a key
bool Util.ContainsKey(dynamic obj, string name);
// Session
void Util.SetSession(string key, object value);
T Util.GetSession<T>(string key);
void Util.RemoveSession(string key);
void Util.ClearSession();
// Cookie
void Util.SetCookie(string key, object value, DateTime? expires = null)
T Util.GetCookie<T>(string key);
void Util.DeleteCookie(string key);
// Udi
Udi Util.GetUdi(this IPublishedContent content);
// Render view as string
string Util.RenderViewAsString(Microsoft.AspNetCore.Html.IHtmlContent partial, System.Text.Encodings.Web.HtmlEncoder encoder);
// Get request files
IFormCollection Util.ReqFiles
// Get request file
IFormFile Util.ReqFile(string name);
// Save file
bool Util.SaveFile(IFormFile file, string path);
// Posted body
System.IO.Stream Util.ReqBody();
string Util.ReqBodyAsString();
// Convert to XDocument
XDocument Util.Json2Xml(string json, string root = "");
XDocument Util.Obj2Xml(object obj, string root = "");
// Convert to JSON
string Util.Obj2Json(object obj);
string Util.Xml2Json(string xml);
// Convert to dynamic
T Util.Xml2Dynamic<T>(string xml);
T Util.Json2Dynamic<T>(string json);
T Util.Obj2Dynamic<T>(object obj);
// Convert stream
string Util.StreamToString(System.IO.Stream stream);
// Send email (Will use smtp settings from appsettings, add from object and look for name parameter in smtp selection to use as from name if fromName parameter not set)
bool Util.SendEmail(System.Net.Mail.MailMessage mailMessage, string fromName = "");
// Combine objects
object Util.CombineObj(object obj1, object obj2, object obj3 = null, object obj4 = null);
// Convert UnixTime to datetime
DateTime Util.DateFromUnixTime(long unixdate);
// Expose object
void Util.DrillObject(object obj);
// Clone object
T Util.CloneObj<T>(T obj);
Secy (Security)
This contains a lot of diffrent small static methods to help you create simple code
// Generate random password
string Secy.GeneratePassword(int passwordLength = 10);
// Hash
string Secy.Hash(string text, bool Use256 = false, bool Use512 = false);
// A2B
string Secy.A2B(string input);
// B2A
string Secy.B2A(string input);
// Encrypt Text
string Secy.EncryptText(string text, string secret = "");
// Decrypt Text
string Secy.DecryptText(string text, string secret = "");
// Generate JWT token
string Secy.GetToken(object payload, string serectKey = "", int expireAfterMinutes = 1440, int notValidBeforeMinutes = 0);
// Check if JWT token is valid
bool Secy.IsTokenValid(string token, string serectKey, out string message);
// Get token headers from JWT
dynamic Secy.GetTokenHeaders(string token);
// Get token payload from JWT
dynamic Secy.GetTokenPayload(string token);
Soap
// Init
var soap = new SOAP(string url);
// Get / Set properties
Dictionary<string, string> soap.Headers;
// Execute
string soap.Execute(string method, string payloadXml = "");
// Result status
int soap.StatusCode;
string soap.StatusDescription;
bool soap.IsSuccess;
Rest
// Init
var rest = new REST(string login = "", string password = "", string seperator = ":", string prefix = "Basic");
// Get / Set properties
string rest.ContentType;
string rest.Accept;
string rest.Method;
string rest.BaseUrl;
bool rest.KeepAlive;
Dictionary<string, string> rest.Headers;
// Execute
string rest.Execute(string url, string payload = "");
// Result status
int rest.StatusCode;
string rest.StatusDescription;
bool rest.IsSuccess;
SQL
// Init
var sql = new SQL(string server, string database, string login, string password);
// Select data from SQL
var reader = sql.GetReader(string sql);
// Loop reader
while(reader.Read()){
// Do stuff
}
// Close reader
reader.Close();
// Insert, Update, Delete etc.
void sql.Execute(string sql);
// Close sql
sql.Close();
Cookiebot
// Init
var cookiebot = new Cookiebot(string cookieName = "CookieConsent", string preferencesName = "preferences", string statisticsName = "statistics", string marketingName = "marketing");
// Properties
bool cookiebot.Necessary;
bool cookiebot.Statistics;
bool cookiebot.Marketing;
bool cookiebot.Preferences;
Log
Injection is required
_vns.Log.Trace(string message, Exception ex = null);
_vns.Log.Debug(string message, Exception ex = null);
_vns.Log.Info(string message, Exception ex = null);
_vns.Log.Warning(string message, Exception ex = null);
_vns.Log.Error(string message, Exception ex = null);
_vns.Log.Fatal(string message, Exception ex = null);
Content
Injection is required
// Create a node
IContent _vns.Content.Create(string name, int parent, string documentTypeAlias, Dictionary<string, object> keyValues = null);
// Get a node
IContent _vns.Content.Get(int id);
// Copy node
void _vns.Content.Copy(IContent content, int parentId);
// Move node
void _vns.Content.Move(IContent content, int parentId);
// Get schedule collection
ContentScheduleCollection _vns.Content.GetScheduleCollection(IContent content);
// Get release date
DateTime _vns.Content.GetReleaseDate(IContent content);
// Set release date - Will set the schedule and save the node
void _vns.Content.SetReleaseDate(IContent content, DateTime releaseDate)
// Get expire date
DateTime _vns.Content.GetExpireDate(IContent content);
// Set expire date - Will set the schedule and save the node
void _vns.Content.SetExpireDate(IContent content, DateTime expireDate)
// Unpublish node
void _vns.Content.Unpublish(IContent content);
// Save node
void _vns.Content.Save(IContent content, ContentScheduleCollection contentScheduleCollection = null);
// Save and publish node
void _vns.Content.SaveAndPublish(IContent content);
// Delete node
void _vns.Content.Delete(int id);
Member
Injection is required
// Properties for current member
bool _vns.Member.IsLoggedIn;
int _vns.Member.Id;
string _vns.Member.Username;
string _vns.Member.Name;
string _vns.Member.Email;
string _vns.Member.Comments;
DateTime? _vns.Member.LastLoginDate;
// SignOut
void _vns.Member.SignOut();
// Validate
bool _vns.Member.Validate(string userName, string password);
// Create member
IdentityResult result = _vns.Member.Create(string name, string email, string password, bool isApproved = true);
IdentityResult result = _vns.Member.Create(string name, string email, string userName, string password, bool isApproved, string memberTypeAlias = "Member");
// IdentityResult properties
bool result.Succeeded;
IEnumerable<T> result.Errors;
// Login
SignInResult result = _vns.Member.Login(string userName, string password);
// SignInResult properties
bool result.IsLockedOut;
bool result.IsNotAllowed;
bool result.RequiresTwoFactor;
// Lock / Unlock
void _vns.Member.Lock(IMember member);
void _vns.Member.Unlock(IMember member);
// Exists
bool _vns.Member.Exists(string userName);
bool _vns.Member.EmailExists(string email);
// Get a member
IMember _vns.Member.Get(); // Will return current loggedin member
IMember _vns.Member.Get(int id);
IMember _vns.Member.Get(Guid key);
IMember _vns.Member.Get(string userName);
IMember _vns.Member.GetByEmail(string email);
// Get multiple members
IEnumerable<IMember> _vns.Member.GetAllMembers(params int[] ids);
IEnumerable<IMember> _vns.Member.GetMembersByMemberType(string memberTypeid)
// Get Types
IEnumerable<IMemberType> _vns.Member.GetAllMembertypes(params int[] ids);
// Get Roles
IEnumerable<IMemberGroup> _vns.Member.GetAllRoles();
IEnumerable<string> _vns.Member.GetAllRoles(int memberid);
// Generate password
string _vns.Member.GeneratePassword();
// Reset password
string _vns.Member.ResetPassword(string email);
// Change password
IdentityResult result = _vns.Member.ChangePassword(string oldPassword, string newPassword);
// IdentityResult properties
bool result.Succeeded;
IEnumerable<T> result.Errors;
// Save member
void _vns.Member.Save(IMember member);
// Delete member
void _vns.Member.Delete(int id);
void _vns.Member.Delete(string userName);
void _vns.Member.Delete(IMember member);
License
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net7.0
- jose-jwt (>= 4.1.0)
- Newtonsoft.Json (>= 13.0.3)
- System.Data.SqlClient (>= 4.8.5)
- Umbraco.Cms.Web.Common (>= 11.3.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
13.5.2 | 82 | 11/15/2024 |
13.5.1 | 102 | 9/30/2024 |
13.5.0 | 116 | 9/13/2024 |
13.4.0 | 116 | 6/21/2024 |
13.3.2 | 92 | 6/10/2024 |
13.0.0 | 103 | 5/30/2024 |
4.0.3 | 95 | 5/2/2024 |
4.0.2 | 135 | 2/8/2024 |
4.0.1 | 110 | 1/17/2024 |
4.0.0 | 169 | 12/14/2023 |
3.0.23 | 121 | 1/17/2024 |
3.0.22 | 133 | 12/13/2023 |
3.0.21 | 145 | 11/7/2023 |
3.0.20 | 145 | 10/26/2023 |
3.0.19 | 139 | 10/4/2023 |
3.0.18 | 121 | 9/21/2023 |
3.0.17 | 158 | 9/1/2023 |
3.0.16 | 143 | 8/15/2023 |
3.0.15 | 152 | 7/14/2023 |
3.0.14 | 172 | 6/30/2023 |
3.0.13 | 163 | 5/26/2023 |
3.0.12 | 204 | 4/12/2023 |
3.0.11 | 207 | 3/28/2023 |
3.0.10 | 254 | 2/24/2023 |
3.0.8 | 292 | 2/9/2023 |
3.0.7 | 286 | 1/31/2023 |
3.0.6 | 318 | 1/31/2023 |
3.0.5 | 283 | 1/25/2023 |
3.0.4 | 305 | 1/25/2023 |
3.0.3 | 293 | 1/18/2023 |
3.0.2 | 300 | 12/14/2022 |
3.0.1 | 296 | 12/14/2022 |
3.0.0 | 298 | 12/6/2022 |
2.0.17 | 386 | 10/28/2022 |
2.0.16 | 400 | 10/24/2022 |
2.0.15 | 598 | 9/13/2022 |
2.0.14 | 552 | 9/13/2022 |
2.0.13 | 467 | 7/11/2022 |
2.0.12 | 479 | 7/11/2022 |
2.0.11 | 498 | 7/10/2022 |
2.0.10 | 465 | 7/10/2022 |
2.0.9 | 530 | 7/10/2022 |
2.0.8 | 501 | 7/10/2022 |
2.0.7 | 479 | 7/2/2022 |
2.0.5 | 465 | 6/30/2022 |
2.0.4 | 467 | 6/30/2022 |
2.0.3 | 461 | 6/29/2022 |
2.0.2 | 494 | 6/29/2022 |
2.0.1 | 462 | 6/29/2022 |
1.0.23 | 471 | 7/2/2022 |
1.0.20 | 498 | 6/29/2022 |
1.0.19 | 471 | 6/29/2022 |
1.0.17 | 491 | 6/2/2022 |
1.0.16 | 516 | 5/11/2022 |
1.0.15 | 516 | 5/10/2022 |
1.0.14 | 500 | 5/10/2022 |
1.0.13 | 499 | 5/9/2022 |
1.0.12 | 471 | 5/9/2022 |
1.0.11 | 516 | 5/9/2022 |
1.0.10 | 534 | 5/9/2022 |
1.0.9 | 537 | 5/9/2022 |
1.0.8 | 566 | 4/30/2022 |