.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan
Asad Ali
Fauzul Azmi
Post New Web Links

A little bug with WebMatrix Sql ce Database , WebSecurity and Roles ?

Posted By:      Posted Date: September 30, 2010    Points: 0   Category :ASP.Net
 

Hi , i'm reviewing heavily the api provided with webpages which is really cool , it reminds me the api zend provides for php.

But i add some issues with WebSecurity and the Roles object.

I think you should not be able to insert multiple times the same role to the same user with the Roles.AddUserToRole(user, role) command cause it makes the database editor bug big time. I could not edit the webpages_UsersInRoles table manually anymore because of identical rows in the Data editor. i had to do a SQL DELETE to be able to edit the table again. So maybe there should be some kind of check if the association exists before inserting another user/role relationship.

I wasn't able to use some methods of simpleroleprovider either. Is it fully implemented?

Anyway , i cant wait for the official stable release.

Regards




View Complete Post


More Related Resource Links

Connecting to MS SQL Server database using webmatrix.

  

Hi,

I am novice  user to raizor syntax using webmatrix and i am trying to connect MS Sql server database (instead of using .sdf file i am using .mdf file) using the tool webmatrix for startersite.

The connection string that i setup as follows.

<?xml version="1.0"?>

<configuration>

    <system.web>
        <compilation debug="false" targetFramework="4.0" />
    </system.web>
    <connectionStrings>
    <add name="OESConnectionString" connectionString="Data Source=.\SQLServer2005;AttachDbFilename=|DataDirectory|\OES_Data.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient" />
    </connectionStrings>

</configuration>

And i am using websecurity helper as well and the setup is as follows.

WebSecurity.InitializeDatabaseConnection("Data Source=INLTE5556\\SQLServer2005;Initial Catalog=OES;Integrated Security=True", "System.Data.SqlClient", "UserProfile", "UserId", "Email", true);

When i am trying to insert the user details into database i am getting the below error.

Format of t

How to stop the repeated database queries for roles

  

Hello, friends,

We have a web application using VS 2008, c#. We try to filter siteMap nodes based on security roles. We have our customized the mether GetRolesForUser() in RoleProvider class to determine a user's role. In this method, roles will be returned by querying an SQL Server database.

However, we found that each time a page was loaded/refershed, this  GetRolesForUser() was called, and the database would be queried. This is too MUCH and expensive.

We thought the roles should be queried only once when a user logs in. After that, role info should be stored somewhere for this user, rather than query DB all the time.

Any ideas, reference paper, snipet,...,?

Thanks a lot!


Error while Deploying WebMatrix Beta Application having SQL Database on Remote Server

  

Hello All,


I have created "DotNetNuke SQL Database Application" from the WebMatrix Gallery.

Now I want to deploy it on the remote server using Web Deploy method.

Without selecting SQL database, application is deployed successfully but when I select SQL database it gives following error:

Publish : Error - Make sure the database connection string for the server is correct and that you have appropriate permission to access the database. (Web Deploy provider is dbFullSql).

Can anyone have the solution of this error?

Thanks in advance....



assigning database roles with smo (C#)

  

Hi All,

I'm using VS C# express with SQL 2005 express.

I have the following problem:

I would like to assign database roles in a given database for a login by using smo. Let's say:

I have a Login, created with smo named MyLogin and a database name MyDatabase.

How can I map MyLogin to MyDatabase and give for example db_datawriter database role membership for it, using SMO?

I do not find the way, propably I miss something...

Any help is highly appreciated, I would be thanksfull if one could give a code example to solve this.

Regards,

Lacko

 


Replication and database roles

  

Hi all!

We have replication set up between 2 servers (SQL 2005) and among tables and views we also replicate procedures. Because roles can't get replicated, we have roles with procedure execute permissions set up on Subscriber server. It works fine until we add procedure at Distrubutor server and reinitialize the subscription. Then database roles get "reset" i.e. all procedure entries are removed. Table entries are left intact in DB role.

Can someone tell me if this is functioning as designed or is something misconfigured. If database role can't get replicated, then it would be nice if they could at least not be replicated.

I would appreciate any help or to be pointed in right direction.

Kind regards, Max


Webmatrix.Data.Database.Query() method return type

  

I'm using the Webmatrix.Data.Database.Query method to return a result set in the following form

var myResult = db.Query("Select * from mytable");

How do you cast myResult to get the count of records returned? I'd like to do something like

   myResult.Count


how to open a database in a webmatrix C# file?

  

In the webMatrix examples, which I have working, it's very easy to access a database. Only three lines are necessary to get up and going:

@{ 
    var db = Database.Open("LOS");  
    var selectQueryString = "SELECT * FROM wknTest"; 
} 

and a little later,

 @foreach(var row in db.Query(selectQueryString)){  

There's no using's, no connection strings, all that happens behind the scenes. But now I have enough complicated c# code that I want to separate it into a separate C# file. How would I do the above, but in a C# file residing in the app_code folder in a webMatrix project? 

WebMatrix must be creating the Database object behind the scenes.  So I'm really asking how do I have access to that.


The trick to force Webmatrix to create the MySQL database install scripts on my local box?

  

 Here is why I ask:

I'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.


Export Database through WebMatrix

  

I have WebMatrix beta 2.  I made a WordPress site on my local box.  I published it using FTP (my hosting does not offer "web deploy").  Of course this means my "MySQL" database was not  published.  So I want to export it separately, and import it manually.  However, I can't find any option in Webmatrix that allows the database to be exported.

Can someone explain how that is done with Webmatrix?


How to import existing database into Webmatrix?

  

I am planning to use Webmatrix as a testing arena for creating and completing the preparation of a website before publishing it. Working with websites on local computer should be much faster than doing that on an online server.

That is why I downloaded a database that I have already created on my online host account, and wanted to import it into webmatrix to continue building my new website using Webmatrix. Here, I did not know how to imort the DB I downloaded from my host, into webmatrix. There is seemingly no way to do that, or to import tables into an existing DB on webmatrix. 

Is that not possible? 

2- I tried to create a new DB on webmatrix which is a part of installing Wordbress on WM (new site from web gallery --> Wordpress), but I get this error :

The database 'xxxx' could not be created. ---> MySql.Data.MySqlClient.MySqlException: Unable to connect to any of the specified MySQL hosts. ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:3306


I have installed PHP 5.2 and Mysql on Webmatrix. 


Why does this happen?


How to import existing database into Webmatrix?

  

I am planning to use Webmatrix as a testing arena for creating and completing the preparation of a website before publishing it. Working with websites on local computer should be much faster than doing that on an online server.

That is why I downloaded a database that I have already created on my online host account, and wanted to import it into webmatrix to continue building my new website using Webmatrix. Here, I did not know how to imort the DB I downloaded from my host, into webmatrix. There is seemingly no way to do that, or to import tables into an existing DB on webmatrix. 

Is that not possible? 

2- I tried to create a new DB on webmatrix which is a part of installing Wordbress on WM (new site from web gallery --> Wordpress), but I get this error :

The database 'xxxx' could not be created. ---> MySql.Data.MySqlClient.MySqlException: Unable to connect to any of the specified MySQL hosts. ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:3306


I have installed PHP 5.2 and Mysql on Webmatrix. 


Why does this happen?


Multiple database support with Entity Framework

  
One of the features introduced in Entity Framework is being database independent. Which mean each database provider can support Entity Framework by implementing its provider.

This feature allows you build applications independent from the underplaying database provider. In this post I'm going to show how to build an application that support multiple databases using same conceptual model made by Entity Framework.

Export Visio Database Table Names to Excel

  
If you use the Enterprise Architect edition of Microsoft Visio for data modeling regularly, then there is a good chance that at some point you've wanted to export just the table names into Excel. You might want to do this to map logical ERD entities to physical data model tables, track project status by entity, or track overlap between database versions.

MS SQL Server: Disconnect Users From Database - Kill User Session

  
If you ever wanted to restore your database from a SQL backup file (.bak), but there are still users connected to your database, the backup operation will fail causing the error: Exclusive access could not be obtained because the database is in use.

Publishing SQL Server Database using Publishing Wizard : Tips & Tricks

  
We can use SQL Server Publishing Wizard to deploy our local Database to remote hosting server/production server.This feature is available in SQL Server 2008/VWD 2008.

Below is the complete step by step guide of this process.

Adding Rows in GridView without using a Database

  
This article describes on how to add rows in GridView without using a database. Basically the GridView will be populated with data based on the values entered in the TextBox on Button Click and retain the GridView data on post back.

Adding Multiple Columns and Rows in GridView without using a Database

  
This article describes on how to add multiple columns and rows in GridView without using a database. Basically the GridView will be populated with data based on the values entered in each TextBoxes on Button Click and retain the GridView data on post back.
Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend