|
I have an xml configuration file in my project.
when I am working in debug mode of .net IDE it is working fine, but when i tried to launch the project from IE, it is taking different path
ex:
below code works well in debug mode, but unable to launch in IE directly (http://localhost/WebProj/login.aspx)
Pathtype A:
HttpContext.Current.Server.MapPath(@"\Configuration\xyz.xml");
below code works well in IE and debug mode but having different problem.
Pathtype B:
HttpContext.Current.Server.MapPath("") + @"\Configuration\xyz.xml";
Problem: I have a folder MainPages under root folder of the project. under this I have AdminPages. These admin pages are not retrieving if I used pathtype B specified above and gives error no page available, but works fine when pathtype A specified above is used which runs in debug mode only but not able launch from IE.
Help me please.
|
|
|
|
|
Hi KishoreT,
if i understand you right, you have the xml-file in a subdirectory of the root of the webpage. The subdirctory is "Configuration". Therefore i suggest you use the following to get the path:
HttpContext.Current.Server.MapPath(@"~\Configuration\xyz.xml");
The difference is the ~ (tilde) character. It represents the homedirectory or root of the webapp.
Hope this helps
Regards
Jens
When in trouble,
when in doubt,
run in circles,
scream and shout
|
|
|
|
|
Hey thank u its working by placing ~.
|
|
|
|
|
Hi,
am using actionchart in one of my asp.net 2.0 application. also now am using "AjaxPro.AjaxHandlerFactory,AjaxPro.2" in this application for that i have added one handler in web.config file.
<httpHandlers>
<!--<add verb="*" path="*.ashx" type="AjaxPro.AjaxHandlerFactory,AjaxPro.2"/>-->
</httpHandlers>
</system.web>
like that.
After that, my action chart is not working!!!
But if am commenting the handler part, action chart will work, but ajaxPro willnot work.
Please help me ASAP.
I have to resolve by the end of today
Thanks & Regards,
Jeneesh K. Velayudhan
|
|
|
|
|
Hi All,
I am Developing a web base project using asp.net mvc 2.0 architecture for my current window based application.
The following things will be used in my project.
1.The Menu and sub Menus
2.Support for multiple database
3.The view for displaying record fetch from the database
4.Making connection to service
so if anybody can give the url for similar projects which i can refer to it will be quite helpful
Thanks in advnace
Ramesh singh
|
|
|
|
|
See here: ASP.Net MVC[^]
me, me, me
"The dinosaurs became extinct because they didn't have a space program. And if we become extinct because we don't have a space program, it'll serve us right!"
Larry Niven
nils illegitimus carborundum
|
|
|
|
|
hi iam using asp.net2.0 with c# with sql server 2000
when iam executing the procedure in local system it is working fine.but when iam executing in client system procedure returns null value, i have checked all connection string , and session value all are working
can you correct the code which helps me
SqlConnection concreate = new SqlConnection(strcon);
string pp = "";
pp = "create procedure getsum( @BranchKey int,@FromDate smalldatetime,@ToDate smalldatetime, @tot decimal output )";
pp += "as";
pp += "\n";
pp += "set @tot=(SELECT SUM(Amount) FROM AllTransactions WHERE BranchKey=@BranchKey and (TransCode <> 0) and (TransDate > @FromDate) and (TransDate < @ToDate) GROUP by BranchKey)";
pp += "return @tot";
pp += ";";
SqlCommand cmdcreate = new SqlCommand(pp, concreate);
concreate.Open();
cmdcreate.ExecuteNonQuery();
concreate.Close();
SqlConnection conproc = new SqlConnection(strcon);
conproc.Open();
SqlCommand cmdproc = new SqlCommand("getsum", conproc);
cmdproc.CommandType = CommandType.StoredProcedure;
cmdproc.Parameters.AddWithValue("@BranchKey", Convert.ToInt32(Session["BranchKey"]));
DateTime dt = Convert.ToDateTime(txtfrom.Text.ToString());
string fromDate = dt.ToShortDateString();
DateTime dt1 = Convert.ToDateTime(txtto.Text.ToString());
string toDate = dt1.ToShortDateString();
cmdproc.Parameters.AddWithValue("@FromDate", fromDate);
cmdproc.Parameters.AddWithValue("@ToDate", toDate);
SqlParameter p1 = cmdproc.Parameters.Add("@tot", SqlDbType.Decimal);
p1.Direction = ParameterDirection.Output;
if ((cmdproc.ExecuteScalar() != DBNull.Value) && (cmdproc.Parameters["@tot"].Value) != DBNull.Value)
{
decimal ot = Convert.ToDecimal(cmdproc.Parameters["@tot"].Value);
if (ot != null)
{
txttotal.Text = ot.ToString();
conproc.Close();
}
}
else
{
clsdataset.ShowAlertMessage("No Data");
}
|
|
|
|
|
|
Not an answer, but a question - Why are you creating the SP in your code?
Shreekar
|
|
|
|
|
Is the data the same in the two systems? Are you sure the query returns anything?
From the documentation for ExecuteScalar:
The first column of the first row in the result set, or a null reference (Nothing in Visual Basic) if the result set is empty.
You could try getting rid of the output parameter and just using a SELECT instead of a SET and RETURN.
Also, look into @ strings rather than lots of concatenation.
|
|
|
|
|
Hi,
I want to use progress bar in my webpage.
I dont want third party control.
How can i use AJAX updateprogress.
Thanks
sjs4u
|
|
|
|
|
|
Hi Freanids,
I am using a Gridview in my project but when i implement sorting on columns its giving following error randomly,
Error is bellow:
Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
Kindly help me on this issue, how i resolve it.
Thanks in advnace
Arsad
|
|
|
|
|
Did you try to google [^]the error message?
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Hi Manas,
Thanks for your suggestion on this actually i tried it before but i didn't succeed at that time as the most of comments suggest to add commond timeout attribute in connection string, for now i again implement it at this time no error occured, as i say it was randomly occur so hoping for best.
Thanks for help
Abbas
|
|
|
|
|
The query timeout happens for the query. So next time it happens, check the query that is executed. Compare it with the query that does not time out.
Maybe that will help?
Shreekar
|
|
|
|
|
|
I want to rewrite the url based on query string in asp.net with c#. it means if url comes
http://app.tasktrek.in/Citylist.aspx?Id=1
then it should be look like
http://app.tasktrek.in/Citylist.aspx/Noida in url
where Id=1 for noida ,
Also have any solution in which I do not want to confiure IIS?
How to do it in asp.net .
|
|
|
|
|
|
Hi Abhijit I studied the above url that u have sent but i am not getting any changes in url when implement.
Actually i want if incoming url is http://localhost:53365/UrlRewrite/City.aspx?Id=1"
then it convert into http://localhost:53365/UrlRewrite/City.aspx/Noida
where noida is cityname that depends on querysring value.
please help me.
|
|
|
|
|
|
Hi all,
I have stucked in regualar expression replace, please help me out
My scenario is as follow
I need to replace the "Anyvalue" with "SomeValue" in following string where "Anyvalue" can be different in different instance.
<?xml version='1.0' encoding='Anyvalue'?>
Any suggestion would be highly appreciable.
Thanks
Rohit
|
|
|
|
|
Rohit16db wrote: where "Anyvalue" can be different in different instance.
I didn't get this point. You mean, "AnyValue" can be different ? And for that values you want to replace with "SomeValue" ?
Can you please let us know what exactly is your business requirments ?
|
|
|
|
|
Consider the following scenario
<?xml version='1.0' encoding='abc'?>
<?xml version='1.0' encoding='def'?>
<?xml version='1.0' encoding='xyz'?>
I need to replace all above kind of string to
<?xml version='1.0' encoding='XYZ'?>
hope this will make sense.
Thanks
Rohit
|
|
|
|
|
I am using ajax scriptmanager to update system time on the webpage. the corresponding code was placed in ContentTemplate. The text out side the contentTemplate also refreshing instead of partial refresh of the page.
pls help me.
code: aspx
------------
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Ajax.aspx.cs" Inherits="WebApplication1.Ajax" %>
<!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>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label2" runat="server" Text="My System time:"></asp:Label>
<asp:ScriptManager ID="ScriptManager1" EnablePartialRendering="true" runat="server"></asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</ContentTemplate>
</asp:UpdatePanel>
<asp:Timer ID="Timer1" runat="server" Interval="500" ontick="Timer1_Tick" />
</div>
</form>
</body>
</html>
//server side code
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;
namespace WebApplication1
{
public partial class Ajax : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if(!IsPostBack)
Label1.Text = System.DateTime.Now.ToString();
}
protected void Button1_Click(object sender, EventArgs e)
{
Label1.Text = System.DateTime.Now.ToString();
}
protected void Timer1_Tick(object sender, EventArgs e)
{
Label1.Text = System.DateTime.Now.ToString();
}
}
}
Pls help to resolve this problem
|
|
|
|