webmatrix

The name 'Database' does not exist in the current context?

强颜欢笑 提交于 2019-12-03 14:03:50
I am getting this error when I try to launch my website using WebMatrix. I have a .cs file which makes a call var db = Database.Open("dbase"); . I have a database in my project called "dbase". I have no web.config file and no imports for using WebMatrix packages since I am launching the site using WebMatrix, so I don't believe I should need them. Do I need to wrap the code in Razor tags, like @{var db = Database.Open("dbase"); } ? This causes an error for me too. What could be causing this? Does anyone have any solutions for this? You need a reference to the WebMatrix.Data.dll assembly (which

should I use WebMatrix to build a real-world website?

社会主义新天地 提交于 2019-12-03 12:04:25
I have gone through hundreds of articles and blog posts that saying WebMatrix is just for beginners and such. my question is, why shouldn't I use WebMatrix to create a real-world working website, like a light-weight Q&A website? we can create anything that is needed for a website, with this tool. so why not to use it? is there something that real websites need, that cannot get done by WebMatrix? it looks like it is ok to create a fully functional and strong website with this tool. but people say you should not use it, why? and I apologize for my terrible English! thanks in advance. Some people

What to use to open an .mdf (SQL Database) file

断了今生、忘了曾经 提交于 2019-12-03 11:14:30
I was hoping to be able to open .mdf file. I am using WebMatrix, I can view the queries there. I can read the schema too. But how can I read the file without using WebMatrix. Its SQL Server file not the Comptact edition. I have searched for web help (Through windows). But all in vain. I will prefer any link or any method to read the basic queries. Brad Christie .sdf is, in fact, a Compact Database file (unless you've changed the extension which would be problematic). SQL Server would be .mdf . SQL Server ( .mdf ) You can attach the database to your local SQLEXPRESS instance and view it. An

“Remember Me” with asp.net web pages

試著忘記壹切 提交于 2019-12-03 03:09:01
I realize that this question may have been asked before, but I can't find anything that matches my situation exactly. I created a website using the WebMail helper in ASP.Net web pages ( not web forms) and WebMatrix. Users are required to login to the website, and there is a "Remember me" box that (in theory) will keep the user logged in until he/she chooses to log out. The website does keep users logged in if they close the browser and reopen it within 20-30 minutes. However, after 20-30 minutes of not accessing the website, the user is logged out. (As an aside, this problem seems to exist

How can I reference data from an AppState variable?

只谈情不闲聊 提交于 2019-12-03 00:55:18
问题 The problem is that I can't find a way to test anything stored in AppState["variableName"] (or App.variableName or HttpContext.Current.Application["variableName"], etc.) inside an if condition. (It only ever sees it as an object, even though I can plot it on the page with Razor as the string variable I thought it was) So, I can't compare them to say an actual string value. I've tried ToString(), among countless other attempts, to no avail. My question is: How can I achieve full functionality

SimpleMemership CreateUserAndAccount Customization

怎甘沉沦 提交于 2019-12-02 22:25:14
I am trying to add a new property to the UserProfile class in my model public class UserProfile { [Key] [DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)] public int UserId { get; set; } public string UserName { get; set; } [Required] [DataType(DataType.EmailAddress)] [Display(Name = "Email Address")] public string Email { get; set; } \\this is the new property public virtual IList<Game> Games { get; set; } } I am trying to add it to my seed method in my Configurations.cs file private void SeedMembership() { WebSecurity.InitializeDatabaseConnection("MafiaContext", "UserProfile",

Error when using LINQ with anonymous classes and implicitly typed arrays in ASP.NET WebPages

▼魔方 西西 提交于 2019-12-02 18:28:19
问题 I am trying to mock up a page using WebMatrix using WebPages under the hood. I have assigned an implicitly typed array of anonymous objects to one of the PageData keys, but I get the following error when I try to using LINQ methods on the collection: CS1977: Cannot use a lambda expression as an argument to a dynamically dispatched operation without first casting it to a delegate or expression tree type Here is some sample code: @{ PageData["Vals"] = new [] { new { ID=1, Quantity=5 }, new { ID

How to add an image to a table cell in iTextSharp using webmatrix

◇◆丶佛笑我妖孽 提交于 2019-12-02 10:11:26
问题 I have made a table with cells and interested in having an image in one of the cell. Below is my code: doc.Open(); PdfPTable table = new PdfPTable(2); table.TotalWidth = 570f; table.LockedWidth = true; table.HorizontalAlignment = 1; //0=Left, 1=Centre, 2=Right PdfPCell points = new PdfPCell(new Phrase("and is therefore entitled to 2 points", arialCertify)); points.Colspan = 2; points.Border = 0; points.PaddingTop = 40f; points.HorizontalAlignment = 1;//0=Left, 1=Centre, 2=Right table.AddCell

Error when using LINQ with anonymous classes and implicitly typed arrays in ASP.NET WebPages

核能气质少年 提交于 2019-12-02 10:08:41
I am trying to mock up a page using WebMatrix using WebPages under the hood. I have assigned an implicitly typed array of anonymous objects to one of the PageData keys, but I get the following error when I try to using LINQ methods on the collection: CS1977: Cannot use a lambda expression as an argument to a dynamically dispatched operation without first casting it to a delegate or expression tree type Here is some sample code: @{ PageData["Vals"] = new [] { new { ID=1, Quantity=5 }, new { ID=2, Quantity=3 } }; var sum = PageData["Vals"].Sum(x => x.Quantity); } If I first store the array in a

Problems Deploying web application to iis

可紊 提交于 2019-12-02 04:40:58
Built a web application with webmatrix, try to deploy locally to iis 5.1 for testing purposes so i added it to my wwwroot folder didnt work then i created a virtual directory. the home page works with this but my login created with web helper doesnt work...when i click login all i see is the browser sending login? and nothing happens....and my web deploy that i installed doesnt work either so i can deploy the site with dependencies to iis... also can it be deployed to windows server2003....any hints would be appreciated... . I am using Webmatrix3 and my web server is Windows Server 2008 R2