WebMatrix :: Difference Between @Href And HrefAttribute
Sep 8, 2010What is the difference between @Href and HrefAttribute?
View 5 RepliesWhat is the difference between @Href and HrefAttribute?
View 5 RepliesI've found a Webmatrix help article that says MS Webmatrix "publishes the (SQL Server or MySQL) database by creating scripts that run in a database that has been created for you by your hosting provider." That is wonderful, except I can't get it to work when I'm trying to publish a MySQL database (backing wordpress) through FTP (my hosting provider does not support 'web deploy'). Again, no problem, since it is already documented that " FTP protocols cannot be used to publish MySQL database. " But this does not excuse Webmatrix from generating MySQL database install scripts for me. During the publishing step, no database install script is generated - at least that I can tell - and there is no manual option to create a database export / backup / install script.
In short, as Webmatrix goes, I'm dead in the water trying to get my database uploaded to my hosting provider. Does anyone know the trick to force Webmatrix to create the MySQL database install scripts on my local box? Once created, I can take-over the upload and install process.
I'm wondering if it is possible to include Microsoft.Data.Entity.CTP.dll reference to WebMatrix site and if the Compact edition of the database would support it? I'd kinda love use something like
code-first development in my WebMatrix project. I think is even easier than writing SQL-s into the code...
I started the Bakery site demo...everything runs fine on my local machine.When I publish the site to production server in w2k8r2+iis7.5 and with .net 4.0 (integrate) pool, my bakery apps not able to connect to the .sdf file.
Error I got is :
Connection string "bakery" was not found. Description: An unhandled exception occurred during the execution of the current web request. review the stack trace for more information about the error and where it originated in the code. Exception Details: System.InvalidOperationException: Connection string "bakery" was not found.
Source Error:
Line 2: Layout = "_SiteLayout.cshtml";
Line 3:
Line 4: FacebookSocialPlugins.Initialize("[xxx]", "[xxx]","bakery");
Line 5:
Line 6: }
Stack Trace:
[InvalidOperationException: Connection string "bakery" was not found.]
WebMatrix.Data.Database.OpenNamedConnection(String name, IConfigurationManager configurationManager) +132
WebMatrix.Data.Database.Open(String name) +42
System.Web.WebPages.DatabaseConnectionInfo.Connect() +43
System.Web.WebPages.SimpleMembershipProvider.CreateTablesIfNeeded() +42
System.Web.WebPages.WebSecurity.InitializeMembershipProvider(SimpleMembershipProvider sMembership, DatabaseConnectionInfo connect, String userTableName, String userIdColumn, String userNameColumn, Boolean createTables) +70
System.Web.WebPages.WebSecurity.InitializeProviders(DatabaseConnectionInfo connect, String userTableName, String userIdColumn, String userNameColumn, Boolean autoCreateTables) +51
System.Web.WebPages.WebSecurity.InitializeDatabaseConnection(String connectionStringName, String userTableName, String userIdColumn, String userNameColumn, Boolean autoCreateTables) +52
FacebookSocialPlugins.InitializeMembershipProviderIfNeeded() +54
FacebookSocialPlugins.Initialize(String appId, String appSecret, String membershipDbName) +171
ASP._PageStart_cshtml.Execute() in d:xxxakery\_PageStart.cshtml:4
System.Web.WebPages.StartPage.ExecutePageHierarchy() +15
System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +33
System.Web.WebPages.WebPageHttpHandler.ProcessRequestInternal(HttpContext context) +207
I know we can use the HTML helpers, but how about the strongly typed one's?
Html.LabelFor()
I struggle with publishing 2 databases from WebMatrix using WebDeploy. On Publish settings screen I specify 2 different connection strings, but on Publish Compatibility screen Database names in both destination connection strings are equal. When I return to settings screen, original value is replaced there as well.
How destination server connection strings are evaluated? Here are connection strings from the root web.config file, which are set by hidden parameters in my parameters.xml:
<connectionStrings>
<add connectionString="Server=(local);Database=xxx;Uid=xxx;Pwd=xxx" name="xxx" providerName="System.Data.SqlClient" />
<add connectionString="Server=(local);Database=xxx2;Uid=xxx;Pwd=xxx" name="xxx" providerName="System.Data.SqlClient" />
</connectionStrings>
If I create two websites using the starter site template logging into one shows me logged into the other.
Here are the steps:
Create starter website called website1 Create starter website called website2 Run both websites in the same browser, firefox Register an account in website1 Log out of website1 Log back into website1 Refresh website2 and it shows my login name from website1 Has anyone else encountered this?
I downloaded WebMatrix thinking I could create a local Intranet page and simply host it from my server. Can I do this with WebMatrix? If so how?
View 1 RepliesI'm often experiencing that keyboard shortcuts stops working in WebMatrix. This is very annoying as CTRL-S, CTRL-C, CTRL-V, etc. stops working, all of which are heavily used when programming. It's obviously hard to explain how to reproduce this, but I waswondering if someone knows a quick-fix?
View 12 RepliesThere I was, happily coding webpages, when suddenly it wouldn't run them anymore. Now when I click run I get an error message that looks like this: Server Error in '/' Application.This type of page is not served. Description:The type of page you have requested is not served because it has been explicitly forbidden. The extension '.cshtml' may be incorrect. Please review the URL below and make sure that it is spelled correctly.
Requested URL: /quiz/intro.cshtml
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1
My hosting company states they support .net and razor. However after uploading my website made with webmatrix and razor *.cshtml pages. When i visit my website all i get is 404.17 error messages. As an testcase i decided to add an standard .aspx page. Visiting that page gives the same 404.17 error message :-(
.
According to my webhoster my web.config is wrong. However that one is generated by webmatrix. Besides my *.cshtml *.aspx a lot of files and directories are added to the bin folder. What can i check and what should my hosting provider check. When using the check compatibility the asp.net version is shown as unknown? My hosting provider claims my site is running asp.net 4.0 in integrated mode and that should be enough.
It's unfortunate that Microsoft WebMatrix (beta) doesn't recognize that files has been modified. I suggest you implement a feature similar to Visual Studio, allowing the user to decide what to do if the file has been modified outside WebMatrix. Especially when you have a button to launch the project in Visual Studio, it should have better support for "dual-development", cause at it is now, code can be overwritten by mistake easily.
View 3 RepliesI got the first beta of WebMatrix, downloaded Drupal, and got a site more or less going. I then tried to move it to two different hosts - first the IIS server running on my own domain controller, then to my hosting service. I dumped the DB with mysqldump, and imported it to the databases running on each server. Then I ftp'd the code and configuration files to both servers, and made appropriate configuration changes (primarily the mysql connect string).On both servers I have the same problem: The site comes up in its home page and looks great, but as soon as I log in as the site admin, I get a 404 (not found) error. Since it looks like virtually everything in Drupal is driven from the database, I really haven't the faintest idea where to start debugging this.
View 3 RepliesThat subject may not do this questions justice.
I am trying to limit what I write on all my .cshtml pages. For example, on everypage I am @using myDLL and "connecting" to sql server.
I write that out like
@using System.myDLL;
@{
myDLL dll = new myDLL();
dll.ConnectionString = "blablabla";
}
How can I remove the need to do that to every single page? I think I can create a web.config and do some funky stuff... can someone show examples?
I am having all sorts of trouble with webmatrix hanging on me and was wondering if someone could test the following to see if it is isolated to me?
If I create a new empty site and add a single php page to it and then try to type the following line webmatrix will hand as soon as I get to the ? after src="
[Code]....
right now I playing around with WebMatrix and I followed the tutorial from http://www.asp.net/WebMatrix. Chapter 6 (displaying data in a grid) described how to use a WebGrid helper very clear, but the data in the example is always retrieved from an SQL DB.I want to use the same XML file from chapter 7 (Displaying data in a chart).Using the code:
...
var DataSet = new DataSet();
dataSet.ReadXmlSchema(Server.MapPath("/App_Data/QCFiler.xsd"));
[code]...
I am trying to publish a sugarcrm site I created in webmatrix to my site hosted on godaddy, however when i go into the publish settings and enter the server info, passwords etc., I can only get the connection to validate for the FTP protocol setting. When i click the button to test and validate the connection for webdeploy instead of ftp, it tries then says connection timed out. How do I get this to work so that I can publish my site on godaddy?
View 3 RepliesI met the same problem as follow link:http://stackoverflow.com/questions/5127284/is-this-a-bug-in-webmatrix-pagedataThe answer to this link is only available to "from a content page to a layout page", but I need "from a content page to a partial page", it still cause the problem.
View 4 RepliesI ahve just downloaded webmatrix and I did that in order to be better at razor. but I would like to know that why sholuld I use webmatrix istead of VS 2010? if it is created, there should be something that VS 2010 doesn't have !
View 4 RepliesWhen I write RenderPage("~/_page.cshtml") and then insert a parameter like RenderPage("~/_page.cshtml", "users") - does that mean I can go inside _page.cshtml and call UrlData[0] to get the word "users"?
If not, how elsecan I take advantage of RenderPage parameters? What is PageData?
i set anchor tag in masterpage as
<a onmouseout="mclosetime()" onmouseover="mopen('m2')" id="AnchorText5" href="#">TEst</a>
but when i run application and it render the page the anchor tag contain href address like
<a onmouseout="mclosetime()" onmouseover="mopen('m2')" id="ctl00_AnchorText5" href="../MasterPages/#">TEst</a>
i also try to set the "#" from code behind but it again show href="../masterpages/#"
I have an ASP.NET 4.0 site that has links to another ASP.NET site (different domain name). In situations where users from domain 1 are directed to a page on domain 2, how would I setup a Javascript routine to create an href back to domain 1? That is, I don't want to place a solid <a> tag on domain 2 pointing back to domain 1. Rather, I need a little bit of script magic that only makes the href available to users coming from domain 1. specific Javascript library/widget that functions in this manner?
View 1 RepliesI am trying to stop XSS attack so I am using html agility pack to make my whitelist and Microsoft Anti-Cross Site Scripting Library to deal with the rest.
Now I am looking at encoding all html hrefs. I get a big string of html code that can contain hrefs. Accours to MS Library they have an URL encode but if you encode the whole URl then it can't be used. So in the example they just encode the query string
UrlEncode Untrusted input is used in a URL (such as a value in a querystring) Click Here!
[URL]
So now my questions is how do I parse through a href and find the query string. Is it always just "?" then query string or can it have spaces and be written in different ways?
Edit
This urls will not be written by me but the users who will share them. So that's why I need a way to make sure I get all query strings and not just ones in valid format. If it can work invalid format I have to grab these ones too. Hackers won't care if it is valid format or not as long as it still does what they want.
What I am trying to achieve is to use an Eval as parameter in my anchor tag's href. The anchor is nested inside a repeater, why I cannot use the code behind to achieve this.
I have tried a few things without any luck.
<a href="http://MyWebsite/ActiveUsers?ID=InsertEvalHere"><%# Eval("Name")%></a>
The following code below is what I have tried to do:
<a href="<% "http://MyWebsite/ActiveUsers?ID=" + DataBinder.Eval(Container.DataItem("ID"))%>"><%# Eval("Name")%></a>
<a href="<% "http://MyWebsite/ActiveUsers?ID=" + Eval("ID")%>"><%# Eval("Name")%></a>
<a href="http://MyWebsite/ActiveUsers?ID=<% DataBinder.Eval(Container.DataItem("ID"))%>"><%# Eval("Name")%></a>
<a href="http://MyWebsite/ActiveUsers?ID=<%# Eval("ID")%>"><%# Eval("Name")%></a>
None of the above seemed to be right, as I keep getting this error - The tag is not well formed.
How should I handle this?
I have a a grid view that one of its columns is a link field. this is my code to generate the link field. It worked with
a href, but not with HyperLink.
here is my code
<ItemTemplate>
<a href="CustomerDetails.aspx?CustomerId=<%#Eval("Customer_Id")%>" target ="_blank"><%#Eval("Customer_Id")%> </a>
</ItemTemplate> [code].....