1. On OnCreatedUser event, I create a folder for each members, so that they can store their files inside those. The thing is I use User.Provider key as a folder name. Is this a good way to store? Is this OK from security view point. Otherwise I am planning to use the User.Username. Here are the codes inside the OnCreatedUser event.
[Code]....
2. Inside these user folders I want to put web.config at run time [at the time of registration]. So that a member cannot access files of other members at any cost. Do you have any idea on creating web.config file at runtime inside these folders? Else if you can provide me any other options, I am eager to listen that. I don't want to call database frequently. So if there is any easy solution.
Sometimes MS provides error message so silly that its hard to understnad and you feel like throwing away all things.
My Web.Config does not contain any entries of MemberShip, Role or Profile.
I want to create a membership provider dynamically through code at runtime. I wrote following code and it receives following error message. I don;t know how come machine.config error appears in my application. how annoying.
Parser Error Message: The connection name 'LocalSqlServer' was not found in the applications configuration or the connection string is empty.
I have an asp.net 4.0 site. I have CAS turned on for legacy support. But in CAS, is there a way to prevent a runtime loaded assembly from accessing the web.config file? I don't see a permission set that denies access to configuration information.
I have a DataTable where the columns are generated programmatically at runtime. I then bind this DataTable to a GridView. What I'm wondering is how I can create the GridView to accommodate this, and if it's not possible, how I can output the DataTable into nicely formatted HTML.
Newbie in using AJAX . Programming in C# and using SQL as a database. Here is my scenario. User selects a project and I want to display the subprojects related to that project. Here is the query I use to retrieve subprojects.
"SELECT SubProjectName,StartDate,Description FROM SubProject WHERE ProjectName'"+ddlProjectName.text+"';
Currently I store the results of the query in a Dataset. I want to get the SubProjectName in the Header of the Accordion and StartDate and Description values to the text box for each accordion. ( This is what I need to do in each accordian for each subproject)
I have a Masterpage that has Treeview. You can select some nodes there. Based on the selection you get some items in the Default.aspx's Placeholder, you get a image and a linkbutton placed in a Panel. Like this :
This code is in the Default.aspx that has the Masterpage.
[Code]....
There seems to be problem when i create the controllers at runtime, when the site does a postback, lets say if i click "Enska" in the treeview i get the results in the image above. Lets say that i then click "The Punk Panther" i get a error.
An error has occurred because a control with id 'ctl00$CPH_Main$ctl05' could not be located or a different control is assigned to the same ID after postback. If the ID is not assigned, explicitly set the ID property of controls that raise postback events to avoid this error.
Also, how would i go by making a event handler for the linkbutton at runtime, can i make one event handler that every linkbutton uses or what ? I want the folder and the linkbutton to be clickable and link to the same place, is it simpler to make the whole Panel clickable, if so, how would i get a "OnClick" event on it ?
I have a requirement whereby one or more image buttons need to be created in a user control at runtime. The number of buttons is determined from a database where a user can add one or more rows that contain an image for each button, so if a user adds 3 images to a table, 3 image buttons are created. Ive used this code but I get an error at runtime
The control collection cannot be modified during DataBind, Init, Load, PreRender or Unload phases.
[Code]....
this is the usercontrol aspx
[Code]....
I basically want one or more buttons to render within the div in the usercontrol. Ive only got the code written for one button at the moment while I test the rendering, eventually they will be rendered in a loop of records taken from a database. Whats the best way to do this ?
I need to create aspx pages on the fly or at the runtime.I read that creating a template page and posting content to the page would be a solution, in a few posts in the forum. Can i get information on this method.
I have an xml file with custom routes that I'm creating routes from on Application_Start in Global.asax. Some of those routes require authentication, some don't. Currently I have "location" entries for all those routes in web.config to control authorization.
I wonder whether there is a way to configure locations on application start at the same time I configure routes, so that I don't need to have entries in web.config.
i am creating some of the control at runtime according database values. problem is that when i click onto the button, if the text box is empty, the required field validator(genrated at runtime) show first time that the text box is empty. but one agin i click on to the button, it doest show any error messege and all of the control which i am genrating at run time are hiding when i see at the page source, no control is find there.
using System; using System.Collections; using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; using AjaxControlToolkit; using click2install.controls; public partial class FeebackForm_Client : System.Web.UI.Page { HtmlGenericControl table = new HtmlGenericControl("table"); DataSet ds = new DataSet(); protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { CreateForm(); } } public void CreateForm() { ds = DBManager.ExecuteDataset("[FeedBack_FeedbackDetail_get]"); for (int i = 1; i < ds.Tables[0].Columns.Count - 1; i = i + 4) { //CreateControl(txtAddress.Text.ToString(), txtAddressRun, false, false, txtAddressToolTip.Text, txtAddressWaterMark.Text); string Name = ds.Tables[0].Rows[0][i].ToString().Replace(" ",""); if (Name != "") { TextBox txtControl = new TextBox(); //RequiredTextBox txtControl = new RequiredTextBox(); txtControl.ID = "txt" + Name; txtControl.CausesValidation = true; bool RequiredField; bool ToolTip; if (ds.Tables[0].Rows[0][i + 3].ToString() == "True") { RequiredField = true; } else RequiredField = false; if (ds.Tables[0].Rows[0][i + 1].ToString() != "") { ToolTip = true; } else ToolTip = false; string TooltipText = ds.Tables[0].Rows[0][i + 1].ToString(); string WaterMarkText = ds.Tables[0].Rows[0][i + 2].ToString(); CreateControl(Name, txtControl, RequiredField, ToolTip, TooltipText, WaterMarkText); } } HtmlGenericControl tr = new HtmlGenericControl("tr"); HtmlGenericControl td1 = new HtmlGenericControl("td"); HtmlGenericControl td2 = new HtmlGenericControl("td"); HtmlGenericControl td3 = new HtmlGenericControl("td"); HtmlGenericControl td4 = new HtmlGenericControl("td"); Button btnInsertRun = new Button(); btnInsertRun.Text = btnSubmit.Text.ToString(); btnInsertRun.ValidationGroup = "Check"; td2.Controls.Add(btnInsertRun); tr.Controls.Add(td1); tr.Controls.Add(td2); tr.Controls.Add(td3); tr.Controls.Add(td4); table.Controls.Add(tr); pnlPreview.Controls.Add(table); System.Threading.Thread.Sleep(500); ScriptManager.RegisterStartupScript(this, GetType(), Guid.NewGuid().ToString(), "Hide();", true); System.Threading.Thread.Sleep(500); ScriptManager.RegisterStartupScript(this, GetType(), Guid.NewGuid().ToString(), "ShowAddDisability()", true); } public void btnInsertRun_Click(object sender, System.EventArgs e) { CreateForm(); //ds = DBManager.ExecuteDataset("[FeedBack_FeedbackDetail_get]"); //TextBox txt1,txt2,txt3,txt4,txt5=new TextBox(); //objBox2 = this.Page.FindControl("objBox2") as TextBox; string ss = "txt" + ds.Tables[0].Rows[0][1].ToString(); //TextBox objTextBox = (TextBox)PnlControlPanel1.FindControl(strControlName); TextBox txt1 = new TextBox(); txt1 = (TextBox)this.Page.FindControl("txt" + ds.Tables[0].Rows[0][1].ToString()); //txt1=this.pnlContainer.FindControl("txt"+ds.Tables[0].Rows[0][1].ToString()) as TextBox; // txt2 = this.pnlContainer.FindControl("txt" + ds.Tables[0].Rows[0][5].ToString()) as TextBox; // txt3 = this.pnlContainer.FindControl("txt" + ds.Tables[0].Rows[0][9].ToString()) as TextBox; // txt4 = this.pnlContainer.FindControl("txt" + ds.Tables[0].Rows[0][13].ToString()) as TextBox; // txt5 = this.pnlContainer.FindControl("txt" + ds.Tables[0].Rows[0][17].ToString()) as TextBox; string fh = txt1.Text; //DBManager.ExecuteNonQuery("Feedback_FeedbackInsert", ds.Tables[0].Rows[0][1].ToString(), txt1.Text,ds.Tables[0].Rows[0][5].ToString(), txt2.Text,ds.Tables[0].Rows[0][9].ToString(), txt3.Text,ds.Tables[0].Rows[0][13].ToString(), txt4.Text,ds.Tables[0].Rows[0][17].ToString(), txt5.Text); Response.Write("Ho Gya"); } public void CreateControl(string Name, TextBox ControlID, bool RequiredField, bool Tooltip, string TooltipText, string WaterMarkText) { if (WaterMarkText == "") WaterMarkText = Name; HtmlGenericControl tr = new HtmlGenericControl("tr"); HtmlGenericControl td1 = new HtmlGenericControl("td"); HtmlGenericControl td2 = new HtmlGenericControl("td"); HtmlGenericControl td3 = new HtmlGenericControl("td"); HtmlGenericControl td4 = new HtmlGenericControl("td"); td1.InnerText = Name; ControlID.ValidationGroup = "Check"; //ControlID.ValidatorMessage = Name + " is Required Field"; //ControlID.ValidatorDisplayType = ValidatorDisplay.Dynamic; //ControlID.ValidatorEnableClientScript = true; td2.Controls.Add(ControlID); if (RequiredField == true) { //RequiredFieldValidator Valid = new RequiredFieldValidator(); //Valid.ID = "Valid" + Name; //Valid.ControlToValidate = ControlID.ID.ToString(); //Valid.ErrorMessage = Name + " is Required Field"; //Valid.Text = "*"; //Valid.Display = ValidatorDisplay.Dynamic; //Valid.EnableViewState = true; //Valid.SetFocusOnError = true; //Valid.Enabled = true; //Valid.EnableClientScript = true; //Valid.InitialValue = WaterMarkText; //Valid.ValidationGroup = "Check"; //td3.Controls.Add(Valid); } if (Tooltip == true) { HtmlGenericControl span = new HtmlGenericControl("span"); //span.Attributes.Add("class", "hotspot"); span.Attributes.Add("onmouseout", "tooltip.hide();"); span.Attributes.Add("onmouseover", "tooltip.show('" + TooltipText + "');"); HtmlImage img = new HtmlImage(); img.Src = "info.png"; span.Controls.Add(img); td4.Controls.Add(span); } //TextBoxWatermarkExtender WaterMark = new TextBoxWatermarkExtender(); //WaterMark.WatermarkText = WaterMarkText; //WaterMark.EnableClientState = true; //WaterMark.TargetControlID = ControlID.ID.ToString(); //WaterMark.Enabled = true; //WaterMark.ID = "WaterMark" + Name; //td1.Controls.Add(WaterMark); tr.Controls.Add(td1); tr.Controls.Add(td2); tr.Controls.Add(td3); tr.Controls.Add(td4); table.Controls.Add(tr); } } after rendring the page... <div id="pnlContainer"> <table><tbody><tr><td>Email</td><td><input type="text" id="txtEmail" name="txtEmail"></td><td></td><td><span onmouseover="tooltip.show('Email');" onmouseout="tooltip.hide();"><img src="info.png"></span></td></tr><tr><td>FirstName</td><td><input type="text" id="txtFirstName" name="txtFirstName"></td><td></td><td><span onmouseover="tooltip.show('First Name');" onmouseout="tooltip.hide();"><img src="info.png"></span></td></tr><tr><td>LastName</td><td><input type="text" id="txtLastName" name="txtLastName"></td><td></td><td><span onmouseover="tooltip.show('Last Name');" onmouseout="tooltip.hide();"><img src="info.png"></span></td></tr><tr><td>City</td><td><input type="text" id="txtCity" name="txtCity"></td><td></td><td><span onmouseover="tooltip.show('City');" onmouseout="tooltip.hide();"><img src="info.png"></span></td></tr><tr><td>Address</td><td><input type="text" id="txtAddress" name="txtAddress"></td><td></td><td><span onmouseover="tooltip.show('Address');" onmouseout="tooltip.hide();"><img src="info.png"></span></td></tr></tbody></table></div>
but after the click on to the button it shows only the container div..
I want to setup the connectionstring of the SqlDatasource of a dropdown list at runtime, eg. Page Load event. I have install MySQl ODBC driver, System DSN name as "MySQL_Employee" If I have an entry in Web.config:
<connectionStrings> <add name="mysqlConnection" connectionString="DSN=MySQL_Employee;UID=john;description=connection to employee database;server=empServer;database=employee;port=3306;" providerName="System.Data.Odbc"/> </connectionStrings>
By external config files, I mean .config files other than web.config. I've seen all the examples on how to edit web.config at runtime, but I want to edit a config file referenced by a configSource for appSettings. I want to modify only the external file and I will handle the app recycle.
I would like to use a built-in class to deal with the edits, but if the only option is a manual File open/parse, etc, then sobeit.
The general behind all this being a Settings page that is viewed at app startup, user sets their particulars and then saves the changes, then the real app starts up. quick and easy install app/configure page, so I'd like to leverage .config if at all possible.
FOLLOWUP - Quick Snippet to use XmlDocument to change an appSetting key value:
My problem is i need to update only the database name in current connection string in web.config at runtime....
this is the sample code .. to update connection string . but it updates the name of connection string i need to change the database name of connection string !
public static void UpdateConnection(string name, string connString) { var webConfig = new ExeConfigurationFileMap { ExeConfigFilename = GlobalSettings.FullpathToRoot + "web.config" };
I'm having problems binding controls at runtime. I've some user controls which need to be bind to the page when one of the dropdownlist selected index changed.
I can able to bind them properly but when if there is any postback event happens I am losing the controls and control values which were created runtime.
I've an item template inside a grid which has a <asp:LinkButton/> inside it. I assign the text for the link button as
<%# Convert.ToString(Eval("Tags"))%>
Tags can have a string with multiple tags in it delimited by space. For eg. "sports", "sports cricket", "sports cricket sachin" are the examples of some possible tags.
I want to create a button for each tag inside the string. How can i create the controls (server control - linkbutton) dynamically during runtime inside the grid item template?
I'd like to mimic the behavior of the "profile provider" that is available in .Net. The profile provider acquires profile properties from the web.config and those properties are immediately available as an enum for use in the code behind.I'm unsure how to do this, and wondered whether someone may be able to help.Essentially I'd like to allow developers to enter Role information into the web.config, and then have this role information available for use within an enum in the codebehind.
I am going to deploy my Application on server but instead of specifying connection string (servername .server userid , password) in web.config manually is their any way of entering the server details in the web.confi file dynamically from client side when i first run the application.
in the starting page the user must specify the server details and database name from which he want the data to be loaded .And once i enter the server details it should bepermanently stored in the web.config file instead of dataabse.
We use Sharepoint to control our websites. We build the sites, then load them into the sharepoint server. My question is if I use windows authentication, how can I get my role security in my web config file to coencide with the asp.net controls that use the Forms authentication. Is there a differenence? Our security uses a session variable for security but there is no where to set up their permissions except in active directory. I hope this makes sense because I would like to implement the LoginView with Role groups but how can I give them the role="administrator"? Do I have to go into active directory and give them these permissions(would take awhile due to the size of the company)? Or do I have to set up priveladges in the web.config file for each user(difficult I think)?
I am working on an ASP.NET project in Visual Studio .NET 2010 and attempting to make an MSI installer using a Web Setup Project. I added the Primary output from the project (which seems to pull in the relevant dependencies) and the Content Files from the project (which pulls in the Web.config and the .svc files).
The issue is that rather than applying the XDT transform and creating the Web.config using the Web.Release.config, it just copies the Web.config, the Web.Release.config, and the Web.Debug.config into the installer without doing any transformation at all.
How do I get it to apply the Web.config transformation before creating the installer?