Increasing capacity of sending file

By default is 4 MB, if we need more just: <system.web> … <httpRuntime targetFramework=”4.5.2″ maxRequestLength=”1048576″ executionTimeout=”3600″ /> … </system.web> <system.webServer> … <security> <requestFiltering> <requestLimits maxAllowedContentLength=”1073741824″ /> </requestFiltering> </security> </system.webServer>

Query by viewbag

in controller: ViewBag.db = <some_query>; in view: foreach (var item in ViewBag.db) { @Html.ActionLink((string)item.table.some, “Index”, “Edit”, new { id = item.someID }, null) }

ASP.NET Failed deploying project on server

If you have error with deploying project on server you might have problem with privileges of exporting files. Add to project_name.csproj file in section PropertyGroup line like bellow: <PropertyGroup> <IncludeSetAclProviderOnDestination>False</IncludeSetAclProviderOnDestination> </PropertyGroup> Tip: If you not see *.csproj in your Solution Explorer just right click on project name and pick Unload Project then another right click […]

Unique name of uploaded files

If you want to prevent situation that you have the same name of upload files use this example: var fileToSave = ┬áDateTime.Now.ToString(“yyyyMMddHHmmssfff”) + “_” + Guid.NewGuid().ToString(“N”) + “-” + SomeYourModelsId + “.pdf”;