|
There is no solution. Change your design. Why ASP.NET application requires registry access? Usually hosting providers will not give access to registry. If you have a dedicated server, you can impersonate the user before accessing registry. But it is nasty.
|
|
|
|
|
Sorry the issue is im not accessing any registry..and moreover i did"nt write any code inside cs file ...and i guess by default ASPNET application may require access to registry....
|
|
|
|
|
pradeep455 wrote: SecurityException: Requested registry access is not allowed.]
System.ThrowHelper.ThrowSecurityException(ExceptionResource resource) +51
Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable) +7460233
System.Security.Cryptography.Utils.get_FipsAlgorithmPolicy() +239
System.Security.Cryptography.RijndaelManaged..ctor() +13
System.Web.Configuration.MachineKeySection.ConfigureEncryptionObject() +232
System.Web.Configuration.MachineKeySection.EnsureConfig() +156
System.Web.Configuration.MachineKeySection.EncryptOrDecryptData(Boolean fEncrypt, Byte[] buf, Byte[] modifier, Int32 start, Int32 length, IVType ivType, Boolean useValidationSymAlgo) +34
System.Web.UI.Page.EncryptStringWithIV(String s, IVType ivType) +83
System.Web.UI.Page.EncryptString(String s) +30
Looks like your are using some session settings in web.config, and that is trying to access machine key for encrypting session data (Although not sure).
|
|
|
|
|
Hi ,
The below is my web.config... please have a look
Actually the below is web.config for AJAX ENabled ASP.net web application
It"s a plain application ie no code wa written in cs file...
Really im struggling frm 2 days please try to help me out...
below is web.config...
<?xml version="1.0"?>
<configuration>
<configSections>
<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="Everywhere" />
<section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication" />
<section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication" />
</sectionGroup>
</sectionGroup>
</sectionGroup>
</configSections>
<system.web>
<pages>
<controls>
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</controls>
</pages>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<trust level="Full" originUrl="" processRequestInApplicationTrust="false"/>
<compilation debug="false">
<assemblies>
<add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</assemblies>
</compilation>
<httpHandlers>
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
</httpHandlers>
<httpModules>
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</httpModules>
</system.web>
<system.web.extensions>
<scripting>
<webServices>
<!-- Uncomment this line to customize maxJsonLength and add a custom converter -->
<!--
<jsonSerialization maxJsonLength="500">
<converters>
<add name="ConvertMe" type="Acme.SubAcme.ConvertMeTypeConverter"/>
</converters>
</jsonSerialization>
-->
<!-- Uncomment this line to enable the authentication service. Include requireSSL="true" if appropriate. -->
<!--
<authenticationService enabled="true" requireSSL = "true|false"/>
-->
<!-- Uncomment these lines to enable the profile service. To allow profile properties to be retrieved
and modified in ASP.NET AJAX applications, you need to add each property name to the readAccessProperties and
writeAccessProperties attributes. -->
<!--
<profileService enabled="true"
readAccessProperties="propertyname1,propertyname2"
writeAccessProperties="propertyname1,propertyname2" />
-->
</webServices>
<!--
<scriptResourceHandler enableCompression="true" enableCaching="true" />
-->
</scripting>
</system.web.extensions>
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules>
<add name="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</modules>
<handlers>
<remove name="WebServiceHandlerFactory-Integrated" />
<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode"
type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode"
type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</handlers>
</system.webServer>
</configuration>
modified on Friday, January 30, 2009 4:30 AM
|
|
|
|
|
|
In windows 2003 server in IIs 6.0 when i tried to change the process account of the application pool to Local System through script(because i should not change manually and that(changing process account) should happen when installing MSI itself) it worked fine ie in IIS 6.0 but im strugling how should i change process acount to Local system in IIS 5.0 thru script....
Any way changing process account to Local System is not safe but i cannot
manually go to registry and add the ASPNET account and give read and write access....
And in IIS 5.0 ie in Windows Xp pro if i set Permissions for
HKLM\SYSTEM\CurrentControlSet\Control\Lsa Select this key and add ASPNET machine account with read and write permissions then im able to clear error Where LSA(local Security Authority)...
But as i said i should not do manually....
|
|
|
|
|
i want to access the textbox control in the masterpage from my other page
|
|
|
|
|
use.. TextBox textboxmaster = (TextBox) Master.FindControl("TextBox ID in MasterPage");
"Don't worry if it doesn't work right. If everything did, you'd be out of a job." (Mosher's Law of Software Engineering)
|
|
|
|
|
Hi all I want to create a very generic search control which i can use it on any page.so as to search the data from the table provided by user,list of columns and the sql will be dynamically created depending on textbox id and there respective values.
Please Suggest how do i create a server control so that i can use it on any page which will be either return dynamic sql or datasource for binding with gridview.
protected void Button1_Click(object sender, EventArgs e)
{
string conn=server=localhost;database=MyData;uid=sa;password=password";
SqlConnection sconn = new SqlConnection();
sconn.ConnectionString = conn;
ArrayList ar = new ArrayList();
ArrayList ar1 = new ArrayList();
foreach (Control c in Panel1.Controls)
{
Type t = c.GetType();
string id;
string value;
string name = t.Name;
TextBox t1 = null;
if (name.Equals("TextBox"))
{
id = c.ClientID;
ar.Add(id);
t1 = (TextBox)c;
if (t1.Text.Length>0)
{
value = t1.Text;
}
else
{
value = "%";
}
ar1.Add(value);
}
}
bool lbHasWhere = false;
StringBuilder loBuffer = new StringBuilder();
loBuffer.Append("Select '"+columns+"' From '" + tablename+ "'");
for (int k = 0; k < ar.Count; k++)
{
if (lbHasWhere)
loBuffer.Append(" And ");
else
{
loBuffer.Append(" Where ");
lbHasWhere = true;
}
loBuffer.Append("" + ar[k] + " like '" + ar1[k] + "'");
}
SqlCommand scomm = new SqlCommand();
scomm.CommandText = loBuffer.ToString();
scomm.Connection = sconn;
sconn.Open();
SqlDataReader sdr = scomm.ExecuteReader();
GridView1.DataSource = sdr;
GridView1.DataBind();
sconn.Close();
}
}
|
|
|
|
|
Hi,
I have an click once application. The prerequisites which i have mentioned is .net Framework 2.0. If the prerequisite is not there, in publish.html, i get a button to download it, else the Run button will install the application (which is developed by me) . This works fine in all the machines, except for one in which i have the following versions of .NET Framework,
.NET Framework 3.0 Service Pack 2 3.2.30729
.NET Framework 3.5 SP1 3.5.30729
.NET Framework 2.0 Service Pack 2 2.2.30729
In this machine even though we have Framework 2.0 and higher versions, i am getting the button to download Framework. This is not correct. Can any one help me on how to overcome this problem.
N.Surendra Prasad
|
|
|
|
|
How to Hide WebForm in ASP.NET on Click of button.
|
|
|
|
|
That is not clear. Read the posting guidelines and rephrase your question.
|
|
|
|
|
Hi everyone,
I have a control who contains a repeater to display some Url whith some parameters below the code of the control
<ul class="chapiter">
<asp:Repeater ID="Chapiters" runat="server">
<ItemTemplate>
<%# ShowLink(DataBinder.Eval(Container.DataItem, "QuestionId"))%>
<a href="SaisiePage.aspx?onglet=2&idchapiter=<%# DataBinder.Eval(Container.DataItem, "QuestionId")%>">
<%# DataBinder.Eval(Container.DataItem, "Description")%>
</a>
</li>
</ItemTemplate>
</asp:Repeater>
</ul>
the problem that in href link i must make a POST to the page not a GET. th problem that for style reason i must keep the <li><a></a></li> to keep the style in the page.
is that possible, is there any trick to do it?
thanks you for help!
|
|
|
|
|
You could use xmlhttprequest, the same thing that you use for AJAX stuff.
|
|
|
|
|
ASALAMOALEKUM,
i am using ASP.NET WITH C# FOR my website.
I have an ONLINE table which stores the id of the user who signin to the site.
Now i want to delete the id of the user from the ONLINE table who signout by using SIGNOUT button or close my website from browser.
behind the SIGNOUT button, i have applied simple sql delete query which works properly but in case of closing browser i have tried the GLOBAL.asax event
APPLICATION_END() ... which contains the same delete query... but it doesnt workssss.. can anyone tell me why its not working ??
do we have to make any settings in webconfig filee??
but as i have put the same delete query in the Session_End() event of global.asax... after 24-25mins of closing the browser it hits and delete the id from the table... i dont want such a great delay...!
please guide if i am missing any imp point in my implementation!
thnks,
Regards,
SANA
$@N@
|
|
|
|
|
You have mis-understood what Application_End is for. It is not for when a user closes the window, but instead is fired when ASP .NET is actually shutting down the web application. You can get lower timeouts by adjusting the session timeout in web.config.
|
|
|
|
|
Sounds like your after Session End in the Global ASAX. You need to kill the session when the user hits the signout by calling Session.Abandon(). That way you don't have to wait for the timeout.
|
|
|
|
|
well this is the solution for signout button only,
my major problem is with BROWSER closing event... i have to delete user's id from ONLINE table at this event.
My website is about chatting.... thats why this user's online/offline state is very important to manage... i cant let user's status remain be online if he/she has closed the application from browser...
$@N@
|
|
|
|
|
This is asked frequently. No events are fired on the server when user closes the browser window. You can follow any of the following suggestions.
1 - Hook a JS method for the browser close event, do AJAX call which delets the record from database. This is less reliable as JS can be turned off from the client.
2 - Keep users last request time in the table. Run a SQL scheduler job which scans this table frequently and if the current time minus last active time is more than the session timeout limit, delete the record. I suggest this method as this is more reliable than the first one.
Does that help?
|
|
|
|
|
hi frndz,
i wanna ask can i change text property of a label of some other webform(.aspx) in current webform(.aspx)
with thanks
Tarun Suneja
|
|
|
|
|
You should only be displaying one webform(.aspx) at a time.
You can pass values from one to another via querystring or storing in session.
Then set the value of the next page on page load.
Don't forget
if (!ispostback)
{
}
I didn't get any requirements for the signature
|
|
|
|
|
If you don't want to use a postback you can try using javascript. Something like ...
window.parent.document.getElementById("X")
|
|
|
|
|
I'm trying to validate a date, however, somehow the same code is not working within one project whilst it is working on the "test" project.
I've also noted that although the OS regional options format is set to dd/mm/yyyy, the format returned by another control (in my case a grid view), is in the following format: 3/31/2009 12:00:00 AM. Is it possible that .NET has its own "default setting"? Information would be appreciated.
I also tried checking the other methods accepted by DateTime.Parse. It would be appreciated if you could guide me as to what they usually mean.
Specifically what options should I fill in for IFormatProvider (a dummy value?) and System.Globalization.DateTimeStyles.
I've skimmed the web high and low so far and haven't found any specific info so far.
Any idea why?
DateTime _dateToValidate;
if (DateTime.TryParse(txtIdealDeliveryDate.Text, out _dateToValidate) != true)
{
Response.Write("Invalid date format for Ideal Delivery Date. Please leave empty or update date in [dd/mm/yyyy] format");
ButtonMode = multifunctionButtonFunction.NoUpdate;
}
.NET Framework 2.0
Related links:
http://msdn.microsoft.com/en-us/library/97x6twsz(VS.80).aspx[^]
Jon
|
|
|
|
|
If I understood you correctly, you want to validate the date and allow only dd/mm/yyyy format. Correct? If yes, following code will do it
string dateString = "3/31/2009 12:00:00 AM";
string dateFormat = "dd/M/yyyy h:mm:ss tt";
DateTime dateTime;
if (!DateTime.TryParseExact(dateString,dateFormat,
CultureInfo.InvariantCulture, DateTimeStyles.None, out dateTime))
else
I am on linux now and I haven't tested the above code. But looks like it will do the job.
|
|
|
|
|
Also it easy to use an asp.net validator control.
<code>
<asp:comparevalidator id="TargetDateValidator" runat="server" type="Date" operator="DataTypeCheck" display="dynamic"
ValidationGroup="Default" ErrorMessage="The target date is not valid format = "mm/dd/yyyy" ControlToValidate="TargetDateTextBox"></asp:comparevalidator>
</code>
I didn't get any requirements for the signature
|
|
|
|
|