Security :: Put 2 Connectionstrings Inside Aspx.cs?

Jul 18, 2010

For example, I have these connectionstrings in my web.config:

<add name="xxx1" connectionString="..."/>
<add name="xxx2" connectionString="..."/>

I want to put 2 connection strings into my aspx.cs page; xxx1 and localsqlserver. I tried to do:

string strConnectionString = ConfigurationManager.ConnectionStrings["LocalSqlServer"].ConnectionString;
strConnectionString += ConfigurationManager.ConnectionStrings["xxx1"].ConnectionString;

but it cannot "detect" the LocalSqlServer. I am trying to populate a GridView with fields from 2 different database, hence I need 2 connectionstrings. Example of my SQL statements:

string strCommandText = "SELECT aspnet_Users.UserName, TableA.Field1, ";
strCommandText += " FROM aspnet_Users, TableA, TableB";
strCommandText += " WHERE aspnet_Users.UserID=TableA.UserID, TableA.ID=TableB.ID";

View 6 Replies


Similar Messages:

Security :: Membership Providers Need ConnectionStrings?

Mar 22, 2010

I am writing a login routine that uses a .NET login control and I have a membership provider as well and set it all up in the config file. But I don't plan on using a connection string as I will be calling a web service in my ValidateUser function. Do I need the connection string in the config because it seems to throw an error if I don't have it.

In that case if you need it then wouldn't it be better to treat this membership provider class more as a normal class and just make calls to it directly like any class and not put any setting on my login control and remove the entry from my web.config

View 5 Replies

Security :: How To Encrypt The ConnectionStrings In File Web.config

Mar 15, 2011

I fully followed the steps in this page [URL]

look at the step 5 at "Using the Example Provider in an ASP.NET Application" element , I entered the command "

aspnet_regiis.exe -pe "connectionStrings" -app "/SessionState" -prov "TripleDESProvider"
" at the windows command line, it asked me "The protection provider 'TripleDESProvider' was not found"

I make sure the files keys.snk and keys.txt are in the same folder and the file web.config is correct. Who can tell me the reason for the error and how do I handle with it?

View 2 Replies

Security :: Using Multiple RoleManager Providers With Different Connectionstrings

Oct 13, 2010

I have two connection strings being used:

<add
name="db1"
connectionString="Server=localhost;user
id=root;password=;persist security info=True;Database=db1"
providerName="MySql.Data.MySqlClient"/>
<add
name="db2"
connectionString="Server=localhost;user
id=root;password=;persist security info=True;Database=db2"
providerName="MySql.Data.MySqlClient"/>

I would like to have two different Role Providers using these connection strings:

<roleManager
enabled="true"
defaultProvider="rp1"
cacheRolesInCookie="true"
createPersistentCookie="false"
cookieProtection="All">
<providers>
<clear/>
<add
name="rp1"
type="MySql.Web.Security.MySQLRoleProvider,
MySql.Web, Version=6.1.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"
connectionStringName="db1"
applicationName="test"/>
<add
name="rp2"
type="MySql.Web.Security.MySQLRoleProvider, MySql.Web, Version=6.1.3.0, Culture=neutral,
PublicKeyToken=c5687fc88969c44d"
connectionStringName="db1"
applicationName="test"/>

My application starts with a login screen. Based on what the user selects, I would like to control which database to connect to. (DB1 vs DB2). The problem is, when the application starts the Role Provider defaults to "rp1". Is there a way I can change the default provider during runtime?

View 5 Replies

Security :: Unable To Encrypt Web.config ConnectionStrings In Web Application Project

Nov 28, 2010

I'm all set on the server side with the RSA key pair installed. Where I'm hung up is trying to get the job done on the web.config file ... can't seem to get the aspnet_regiis command string right. I am using the command string provided by the web host (DiscountAsp.net). Most (all) of the examples I read use a website on the development machine. I actually registered my project in IIS and tried that but it didn't work. In any case I would rather not have to go to the hassle of registering a project in IIS anyway if I can avoid it.

Details:

My web application project is in a folder on my local machine:

D:Projects<project name>

This is most recent (failed) attempt to use aspnet_regiis:

C:WINDOWSMicrosoft.NETFrameworkv4.0.30319aspnet_regiis.exe -pe "connectionStrings" "D:Projects<project name>"

Is it possible to just do this manually by looking at the NetFrameworkConfigurationKey_xxxxx.xml file and entering the values? Seems like it should be do-able except I'm not sure how to parse the xml file for the correct values.

On a related note, when I add the following code to web.config it "announces" that "The keyContainerName attribute is not allowed". Ditto useMachineContainer

[Code]....

View 2 Replies

Security :: Retreive Login Control Text Box Inside Aspx Page?

Feb 27, 2010

I am using default asp.login control similar to this (inside a LoginView)

[Code]....

I am adding a default text to both of the text field (usrname and password) when the page first load (C#).

[Code]....

I am just wondering how can I retreive the Textboxes (user name and password) to that I can clear the default text on focus.

All I need is how I can get the reference of the text boxes inside a javascript function .

View 4 Replies

JQuery - ASPX Security Libraries / Looking For A Combo To Send Data From JavaScrpit To ASPX?

Jun 6, 2010

i would like to know if there's a combo like jCryption (jCryption) - PHP but for jQuery - ASPX.I mean, I have been searching for a combo to send data both ways (Client-server, server-client) with jQuery to ASPX. The best I found was jCryption that sends data from JavaScrpit to PHP. I need a combo to send data from JavaScrpit to ASPX.

PD: Please don't tell me to use HTTPS, it's not enough to ensure the data communication on a client - server application.

View 1 Replies

Security :: Only Allow Logged In Users To View Default.aspx, And About.aspx?

Nov 28, 2010

First of all, thank you for the attention.

I am having some trouble, I am very new to asp.net, and the last problem I had, I spent about 59 hours trying to solve, Now I have a new one !

:D well, I guess this is part of the learning process...

Well, in Visual Studio 2010, I clicked New Website. @ C# language, ... The template it gives is pretty nice, it creates a database MDF file, and a login/register setup ready to go !...

You guys can see it live AT CLICK HERE ...

Everything is working, well at least here at the local machine...

There are 2 pages in there, Default.aspX, and About.aspx ... I want to allow ONLY logged in users to view those 2 pages... I tryed a few things, added my account to a role called ADMIN,

In the web.cong I changed Allow"*" to allow"ADMIN" ... still didn't work.. Also, I was trying to avoid using roles for now, and I was trying to find a way to do this for individual pages in the same directory as well... If possible with out touching the web.config file...

View 3 Replies

How To Place An Aspx Page Inside Update Panel Of Another Aspx Page

Aug 23, 2010

is it possible to place an aspx page inside the update panel of another aspx page? if possible let me know the way to do that.

View 1 Replies

Configuration :: Web.config-connectionstrings

May 11, 2010

I use visual studio 2008 login controls to build up a login web page and have a hosting MS SQL with godaddy. After the login page is finished, I went to server explorer to publish DB to provider and save it in .sql. Then I went to godaddy hosting and executed the exported query. I also added the following connectionstrings to the web.config

<connectionStrings>
<remove
name="LocalSqlServer"/> [code]....

When I run the website, I received the following error

Configuration Error

Description:An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.

Source Error:
[Code]....
Question 1: I have also copied membership,profile,rolemanager from .NETconfigmachine.config to web.config but it didn't solve the error.Question 2: Can I use this built in control with its express DB or I have to create one by my own? What should I do in web.config for connectionstrings?

View 6 Replies

Security :: 4 Security Via Windows Authentication - Restrict Access To Safe / UCantSeeMe.aspx

Aug 18, 2010

I'm writing a simple Intranet application using windows authentication. I want to restrict access to Safe/UCantSeeMe.aspx. I am aware of the AuthorizeAttribute, but this only works on methods. I also found a good post on doing this with the MVC pattern, but I'm not using MVC. This can be done with roles in forms based security. I read on MSDN that using windows based security means roles are based on groups, but it doesn't go into any detail. how can I restrict access to Safe/UCantSeeMe.aspx?

View 1 Replies

AJAX :: Open A New Aspx Page Inside Aspx Page?

Nov 30, 2010

How we can open a new aspx page in update panel embedded on current page. I want to open that page on some ajax event...

View 7 Replies

C# - Encrypting ConnectionStrings In A Web.config File?

Feb 4, 2011

Any section in my web.config file that I want to encrypt I run this command line util:

aspnet_regiis -pe "anySection" -app "/SampleApplication"

It all works just fine until I try encrypt my connectionStrings sections

I define (and I cannot change this) my connectionStrings section like this:

[code]....

Is there a way of doing this using the aspnet_regiis util? Doing it with code is not an option for me.

Also is there a way to run this untility without specifing the application (-app "/SampleApplication") instead giving the path to the web.config file?

View 2 Replies

ADO.NET :: How Do Convert MDF Connectionstrings / Use Sql Authentication Rather Than Windows

Mar 4, 2011

I'm trying to run my simple application online for the first time but keep getting the following error for pages with sqldatasources on them:

Login failed. The login is from an untrusted domain and cannot be used with Windows authentication.

I read somewhere that it's because I'm using Windows Authentication for my connectionstrings and that to avoid this error I should use sql authentication. I'm using Visual Studio 2008. How does one go about getting a .MDF database to use sql or mixed mode authentication rather than Windows?

I'm stumped because I know I'd have to add users to "security" but I just don't know where I'd do it because when I right click on app_data, add new item and add sql server database it does not further ask if I want the new mdf file to use sql authentication, which is what I want so my connectionstrings don't produce the error I've bolded above.

View 2 Replies

Security :: Redirect To Main.aspx After Successful Login Attempt In Login.aspx Page

Apr 25, 2010

I'm trying to develop a simple web application where I need to redirect to main.aspx after successful login attempt in login.aspx page.However,it is redirecting the page to defualt.aspx... Is there a way to redirect my application to main.aspx??

View 3 Replies

DataSource Controls :: Sqldatasource Subquery With Two Connectionstrings?

Jun 7, 2010

I need to run a query on server1.database1 where subquery meets criteria on server2.database2. Here's my code:

[Code]....

I tried replacing connectionstrings:connectionstring2 with server2.database2.dbo.scheduledvisits but it didn't know where to look to find that besides by using connectionstring1.

View 2 Replies

Configuration :: Encrypting ConnectionStrings On A Hosted Website?

Feb 23, 2011

I have been reading up on encrypting the connectionStrings section of the web.config file and I have noticed that all of the methods embed the cypher key in either the registry or the machine.config file. My site is currently being hosted for me by a hosting company and as such I do not have direct access to the registry (or aspnet_regiis for that matter). I was wondering what options are available to me if I cannot use the usual aspnet_regiis method or am I misreading the posts?

View 4 Replies

Configuration :: Encrypting ConnectionStrings With RSA Container On Remote Sever

Oct 22, 2010

How do I use aspnet_regiis to encrypt <connectionStrings> on a website that is hosted remotely? I guessing I need to use a machine-level container? I was able to do it locally with a user level container using this command:

aspnet_regiis -pef "connectionStrings" C:mysite -prov "DataProtectionConfigurationProvider"

but now I need to encrypt parts of the web.config in my real site hosted remotely and don't know how to do it I've created a custom RSA key and exported it to an xml file (is that the right way to do it?) but how do I use it in the web.config file?

View 1 Replies

DataSource Controls :: User Specific Connectionstrings And Linq?

Mar 25, 2010

We have a ASP.NET 3.5 application where we want each user to have their own database. Everyone uses the same web application, but the database their data is kept separate from all others. So every customer has his own database. All database structures are identical, so the only thing the application has to do is connect to the right one when the user logs in.

I envision that we look up a connectionstring to their data at the time they log in and set it globally for that session. With Linq, the connection is handled automatically though, in the background, based on the setting in the web.config file. Unlike SQL Server where you set it each time you use it, with Linq it is hidden in the .NET generated class files.

View 1 Replies

How To Avoid Initialization Of Web User Control Inside Aspx

Feb 23, 2010

I have an aspx page which contains a web user control as below.

[code]...

In the Page_Load method of the above page I am setting the Visible = true/false (based on some condition) for the WebUserControl1. WebUserControl1 contains lots of control itself. But I don't want to initialize the controls inside WebUserControl1. Is there anyway we can avoid initializing the ChildControls of WebUserControl1?

View 2 Replies

C# - How To Access A Web Control Inside A UserControl From Aspx Page

Jun 16, 2010

i have 2 textbox controls inside a usercontrol TextBoxUC.ascx i have a page.aspx that contains the usercontrol. how can i get a reference to each textbox using javascript from page.aspx?

View 3 Replies

JQuery :: Want To Show The Aspx Page Inside Thickbox?

Aug 4, 2010

i want to show the aspx page inside thickbox using jquery.

View 2 Replies

JQuery :: How To Load Aspx Page Inside Tabs

Jan 27, 2011

At the moment, I have an aspx page with a tabcontainer (ajax toolkit). Inside each tab, I have a little form or other content. At page load, each tab is loaded. Technically I can load the tabs at tabclick (with use of update panels) but this result in unnecessary data traffic.

Is there are a way or example how to use jquery tabs that loads aspx content (html)?

This way we can still use vs.net design tool with aspx pages and load data in a much smarter way.

View 4 Replies

Web Forms :: Showing Video Inside Aspx Page?

Jan 12, 2011

How to show video (.wmv file) inside aspx page. Currently am doing with the help of javascript.When i click on link the video will open in separate window. instead of that I want that video to

View 3 Replies

How To Load Aspx Page Dynamically Inside A JQuery UI Dialog

Apr 1, 2011

need to open an aspx page (called editItem.aspx in code below) loaded dynamically inside a jQuery UI dialog from a parent aspx page. the child page
has a button server control and should go back to parent page after postback. with the following code I get the error"The state information is invalid for this page and might be corrupted"

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="popOver.aspx.vb" Inherits="test5.popOver" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
[code]...

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved