|
hello friends..I want to create url like www.website.com/iamdking .when I type this url in browser ..i must be redirected to my profile.suppose profile.aspx.How to do this..Plz help me..
|
|
|
|
|
Hi,
I wanted to display some values in the datagrid as links but I don't know how.
If I write the code like this:
...
dtDocuments.Columns.Add("XML TreeView");
dtDocuments.Columns.Add("XML privzeto");
foreach(DataRow dr in dtDocuments.Rows)
{
dr["XML TreeView"] = "Prikaži";
dr["XML privzeto"] = "Prikaži";
}
dgDocument.DataSource = dtDocuments;
dgDocument.DataBind();
...
it displays a text
|
|
|
|
|
here I see it displays as links, but when I try to run the script it doesn't display links in the dataGrid
|
|
|
|
|
There was some mistake in my previous question,pls consider new one:
for url rewriting i wrote following code in web.config
<configSections>
<!-- The <configSections> element must contain a <section> tag for the <RewriterConfig> section element.
The type of the section handler is RewriterConfigSerializerSectionHandler, which is responsible for
deserializing the <RewriterConfig> section element into a RewriterConfig instance... --><b></b>
<section name="RewriterConfig" type="URLRewriter.Rewriter,URLRewriter" />
</configSections>
<RewriterConfig>
<Rules>
<!-- Rules for Content Displayer -->
<RewriterRule>
<url>/urlrewriter/UserList\.aspx</url>
<rewrite>Userdefault.aspx</rewrite>
</RewriterRule>
</Rules >
</RewriterConfig>
Then i took one class file named Rewriter.cs in which i wrote this code:
namespace URLRewriter
{
public class Rewriter : IConfigurationSectionHandler
{
protected XmlNode _oRules = null;
protected Rewriter()
{
}
public string GetSubstitution(string zPath)
{
Regex oReg;
foreach (XmlNode oNode in _oRules.SelectNodes("Rules"))
{
oReg = new Regex(oNode.SelectSingleNode("url/text()").Value);
Match oMatch = oReg.Match(zPath);
if (oMatch.Success)
{
return oReg.Replace(zPath,
oNode.SelectSingleNode("rewrite/text()").Value);
}
}
return zPath;
}
public static void Process()
{
Rewriter oRewriter = (Rewriter)ConfigurationSettings.GetConfig("system.web/RewriterConfig");
string zSubst = oRewriter.GetSubstitution(HttpContext.Current.Request.Path);
if (zSubst.Length > 0)
{
HttpContext.Current.RewritePath(zSubst);
}
}
#region Implementation of IConfigurationSectionHandler
public object Create(object parent, object configContext, XmlNode section)
{
_oRules = section;
// TODO: Compile all Regular Expressions
return this;
}
#endregion
}
}
And at last i add a glabal.asax file and wrote following code in this file:
protected void Application_BeginRequest(Object sender, EventArgs e)
{
URLRewriter.Rewriter.Process();
}
But when i tried to run it,it gives an error i.e. Object reference not set to an instance of an object in Rewriter.cs at
Rewriter oRewriter = (Rewriter)ConfigurationSettings.GetConfig("system.web/RewriterConfig");
Anybody help me...
Thanks in Advance.
|
|
|
|
|
for url rewriting i wrote following code in web.config
<configsections>
<rewriterconfig>
<rules>
<rewriterrule>
<url>/urlrewriter/UserList\.aspx
<rewrite>Userdefault.aspx
Then i took one class file named Rewriter.cs in which i wrote this code:
namespace URLRewriter
{
public class Rewriter : IConfigurationSectionHandler
{
protected XmlNode _oRules = null;
protected Rewriter()
{
}
public string GetSubstitution(string zPath)
{
Regex oReg;
foreach (XmlNode oNode in _oRules.SelectNodes("Rules"))
{
oReg = new Regex(oNode.SelectSingleNode("url/text()").Value);
Match oMatch = oReg.Match(zPath);
if (oMatch.Success)
{
return oReg.Replace(zPath,
oNode.SelectSingleNode("rewrite/text()").Value);
}
}
return zPath;
}
public static void Process()
{
Rewriter oRewriter = (Rewriter)ConfigurationSettings.GetConfig("system.web/RewriterConfig");
string zSubst = oRewriter.GetSubstitution(HttpContext.Current.Request.Path);
if (zSubst.Length > 0)
{
HttpContext.Current.RewritePath(zSubst);
}
}
#region Implementation of IConfigurationSectionHandler
public object Create(object parent, object configContext, XmlNode section)
{
_oRules = section;
// TODO: Compile all Regular Expressions
return this;
}
#endregion
}
}
And at last i add a glabal.asax file and wrote following code in this file:
protected void Application_BeginRequest(Object sender, EventArgs e)
{
URLRewriter.Rewriter.Process();
}
But when i tried to run it,it gives an error i.e. Object reference not set to an instance of an object in Rewriter.cs at
Rewriter oRewriter = (Rewriter)ConfigurationSettings.GetConfig("system.web/RewriterConfig");
|
|
|
|
|
I am new to Microsoft AJAX. I have created a simple UI to just list, add , edit and update using GridView. The code works fine when the page to directly called. I have another page with IFRAME, where the AJAX page it called inside the IFRAME.
Now, I getting a JScript Error message,
Sys.ArgumentOutOfRangeException.....
Anybody help me...
Thanks in Advance.
|
|
|
|
|
This pronblem is solved by setting the frameborder=0 or frameborder=1, before I set it as frameborder=no.
|
|
|
|
|
hello,
i got error message while creating cotrol in visual studio 2003(ASP.NET)
|
|
|
|
|
Hi All,
what is GUID ?
Thanks
|
|
|
|
|
|
Hi All,
What is the Difference between Unit Testing and UserAcceptanceTesting.
Tell me Briefly what we have to do in UserAcceptanceTesting.It is also related to Testing pages ?
Thanks inAdvance
|
|
|
|
|
siddisagar wrote: What is the Difference between Unit Testing and UserAcceptanceTesting.
Unit testing is testing the individual units of an application, preferably in isolation. This ensures that all (or almost all) the code is exercised and producing the correct results.
User Acceptance Testing is just as the name suggests. It is testing performed by the users so that they may determine if the software is acceptable.
siddisagar wrote: Tell me Briefly what we have to do in UserAcceptanceTesting
Give the software to the users. Ask them to perform the tasks that they wish to do with the software. Get them to report on anything that does not work.
|
|
|
|
|
SqlConnection conn = new SqlConnection(ConfigurationSettings.AppSettings("ConnectionString"));<br />
SqlCommand command = new SqlCommand("Select CurrentNo From LookUpID Where TypeID = 'AuctionSessionID'",conn);<br />
<br />
string result = command.ExecuteScalar().ToString();<br />
Label2.Text = result;
y does it keep saying Error 9 'System.Configuration.ConfigurationSettings.AppSettings' is a 'property' but is used like a 'method'
i am using asp.net2
and my web.config connection is:
<connectionStrings><br />
<add name="HASDBConnectionString1" connectionString="Data Source=----\SQLEXPRESS;Initial Catalog=HASDB;Persist Security Info=True;User ID=---;Password=----"<br />
providerName="System.Data.SqlClient" /><br />
</connectionStrings>
|
|
|
|
|
hi there:
try this ConfigurationSettings.AppSettings["ConnectionString"];
<< >>
|
|
|
|
|
SqlConnection conn = new SqlConnection(ConfigurationManager.AppSettings["ConnectionString"]);<br />
SqlCommand command = new SqlCommand("Select CurrentNo From LookUpID Where TypeID = 'AuctionSessionID'",conn);<br />
conn.Open();<br />
string result = command.ExecuteScalar().ToString();<br />
Label2.Text = result;<br />
conn.Close();
error: The ConnectionString property has not been initialized
erm.. just to chk my ConfigurationManager.AppSettings["ConnectionString"]);
the connectionstring remain? in regards to my original post.
|
|
|
|
|
there is no name ConnectionString in your web.config right?
I saw it was HASDBConnectionString1, so just try to use this name instead of ConnectionString
<< >>
|
|
|
|
|
its still the same saying it has not been initialise...
is executedscaler very hard to use?
i been trying out for veri long still cannot work
the asp.net2 developers makes displaying multiple data in datagrid so easy yet they forgot to make dispalying single data easy.....
|
|
|
|
|
For,
neodeaths wrote: SqlConnection conn = new SqlConnection(ConfigurationSettings.AppSettings("ConnectionString"));
Use,
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"]);
|
|
|
|
|
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"]);<br />
<br />
SqlCommand command = new SqlCommand("Select CurrentNo From LookUpID Where TypeID = 'AuctionSessionID'",conn);<br />
conn.Open();<br />
string result = command.ExecuteScalar().ToString();<br />
Label2.Text = result;<br />
conn.Close();
error:Error 59 Argument '1': cannot convert from 'System.Configuration.ConnectionStringSettings' to 'string'
and
Error 58 The best overloaded method match for 'System.Data.SqlClient.SqlConnection.SqlConnection(string)' has some invalid arguments
now these 2 errors...
|
|
|
|
|
Can you send the content of your web.config file? I have a doubt whether you have the key with name "ConnectionString"...
|
|
|
|
|
please know taht i am using asp.net2 (2005) with sql server 2005 thx
<?xml version="1.0" encoding="utf-8"?><br />
<configuration xmlns=<br />
"http://schemas.microsoft.com/.NetConfiguration/v2.0"><br />
<connectionStrings><br />
<add name="HASDBConnectionString1" connectionString="Data Source=------\SQLEXPRESS;Initial Catalog=HASDB;Persist Security Info=True;User ID=sa;Password=---"<br />
providerName="System.Data.SqlClient" /><br />
</connectionStrings><br />
<system.web><br />
<authorization><br />
<allow roles="Registrator" /><br />
<deny users="*" /><br />
</authorization><br />
</system.web><br />
</configuration>
the above is my web.config in the subfolder where the page i am working on is
<?xml version="1.0"?><br />
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0"><br />
<connectionStrings><br />
<add name="HASDBConnectionString1" connectionString="Data Source=---\SQLEXPRESS;Initial Catalog=HASDB;Persist Security Info=True;User ID=sa;Password=---"<br />
providerName="System.Data.SqlClient" /><br />
</connectionStrings><br />
<system.web><br />
<br />
<membership defaultProvider="MyMembershipProvider"><br />
<providers><br />
<add name="MyMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="HASDBConnectionString1" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7" minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10" passwordStrengthRegularExpression="" /><br />
</providers><br />
</membership><br />
<br />
<br />
<br />
<br />
<roleManager enabled="true" defaultProvider="MyMembershipProvider"><br />
<providers><br />
<add name="MyMembershipProvider" connectionStringName="HASDBConnectionString1" applicationName="/" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /><br />
<add name="AspNetWindowsTokenRoleProvider" applicationName="/" type="System.Web.Security.WindowsTokenRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /><br />
</providers><br />
</roleManager><br />
<authentication mode="Forms" /><br />
<compilation debug="true"/><br />
<authorization><br />
<br />
<deny users="?" /><br />
</authorization><br />
<br />
</system.web> <br />
<system.net><br />
<br />
<mailSettings><br />
<br />
<smtp><br />
<network host="my.mail.server" /><br />
</smtp><br />
</mailSettings><br />
</system.net><br />
</configuration>
this is the web.config of my main project
SqlConnection conn = new SqlConnection(ConfigurationManager.AppSettings["ConnectionStrings"]);<br />
SqlCommand command = new SqlCommand("Select CurrentNo From LookUpID Where TypeID = 'AuctionSessionID'",conn);<br />
conn.Open();<br />
string result = command.ExecuteScalar().ToString();<br />
Label2.Text = result;<br />
conn.Close();
The ConnectionString property has not been initialized.
|
|
|
|
|
SqlConnection conn = new SqlConnection(ConfigurationManager.AppSettings["connectionStrings"]);
by the way for my knowledge =P
what does the above code the part where i underline stand for?
is it something in the web.config?
or an variable?
|
|
|
|
|
neodeaths wrote: SqlConnection conn = new SqlConnection(ConfigurationManager.AppSettings["connectionStrings"]);
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["HASDBConnectionString1"]);
Do not use ConfigurationManager.AppSettings as you have placed the key inside connectionStrings section of the configuration file.
neodeaths wrote: SqlConnection conn = new SqlConnection(ConfigurationManager.AppSettings["ConnectionStrings"]);
The ConnectionString is the key name you specified in the web.config file in the connectionStrings section. In your configuration file you are using HASDBConnectionString1 as the key name.
|
|
|
|
|
firstly:
after i change it to<br />
SqlConnection conn = new SqlConnection("HASDBConnectionString1 ");<br />
SqlCommand command = new SqlCommand("Select CurrentNo From LookUpID Where TypeID = 'AuctionSessionID'",conn);
i changed it to the above code and a new error appear at runtime.
Format of the initialization string does not conform to specification starting at index 0.
2nd:
so if i get u rite the configurationmanager.appsetting is a method that will use the specified connectionstring which is in the root folder?
3rd: i appreciated ur pateint with my noobish question =)
|
|
|
|
|
neodeaths wrote: SqlConnection conn = new SqlConnection("HASDBConnectionString1 ");
This is wrong. I am afraid whether you know .NET or not.
Use like this,
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["HASDBConnectionString1"]);
|
|
|
|