|
I have found this site http://www.spiffycorners.com/[^] very useful for creating rounded corners on div tags. It is a cross browser solution using CSS which is generated for you when you supply background and foreground colours.
;-]
|
|
|
|
|
I am creating ASP.NET pages that need to read log information from the IIS log file. I want to count IP numbers in the log to get some visitor statistics.
The problem is that the web site is hosted in a server that is shared with other companies and web sites. I have FTP access to the folder that contains log files to my account, but I don't know how to get access to that folder from ASP.NET code.
Using Server.MapPath seems not to work because the log files is at same level at the "wwwroot" folder. They are stored like this:
/logs
/wwwroot
This is how it is seen via a FTP client. "wwwroot" contains all web pages. "logs" contain the log files.
I have also tried hard code some folder paths (checking with DirectoryExists), but without success.
Is there any general way to obtain the folder path to the IIS log folder? Any class or function that can return the path? Or is there any general way to read information in IIS log files?
I can not just figure out how to read the log files in that folder...
|
|
|
|
|
If you are in a shared hosting environment then you probably don't have access other than through FTP. This is natuarally for the security of the other people you are sharing the server with. Regardless, this is a question you should be asking your ISP becuase they can choose to put the logs anywhere they like.
|
|
|
|
|
I have a form that I only want the select feature visible if a user is logged in. For whatever reason when I run the following code, the select button still appears. I know my checking is ok because I also want to hide the submit button and that works. I am sure I am doing something not right. Help me please. Here is the code I am using.
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack)
return;
BooksBLL bll = new BooksBLL("C");
Book[] books = bll.allBooks();
GridView1.DataSource = books;
GridView1.DataBind();
if (Session["role"] != null)
{
if ((UserRoles)Session["role"] != UserRoles.User && (UserRoles)Session["role"] != UserRoles.Admin)
{
uxBtnSubmit.Visible = false;
GridView1.AutoGenerateSelectButton = false;
}
}
else
{
uxBtnSubmit.Visible = false;
GridView1.AutoGenerateSelectButton = false;
}
}
|
|
|
|
|
I'm assuming you've already figured this out, though realistically I doubt that this should even be a question on the board...
The most obvious this to do here would be to add a debug (or watch / break) statement that would print the value of Session["role"]. This should give you all the information you need to figure out where the problem is. My guess would be that the Session variable is being incorrectly instantiated with a value of 'User' or 'Admin' somewhere else in the system but you should really be doing basic analysis like this before you start posting questions. Quite frankly, it's lazy developing.
It definitely isn't definatley
|
|
|
|
|
Hi all
Can i bind data From sql table to Calender controle in asp.net 2.0
and thanks for ur help
Kareem Elhosseny
|
|
|
|
|
kimo code wrote: Can i bind data From sql table to Calender controle in asp.net 2.0
if You want to bind Table data with Calendar , then yes !! you can
Check This[^]
cheers,
Abhijit
|
|
|
|
|
yes my friend i want to bind some date from my table to the calender controle and i want the calender change specific dates highlighted and display relevant data for that date the dates and data comes from the data base
in another foruns they told me i can use DayRender event but i dont know how i can use it
Kareem Elhosseny
|
|
|
|
|
Did you see what linked I have provided to you . This is what that you want ?
kimo code wrote: can use DayRender event but i dont know how i can use it
Google is always there !!!
cheers,
Abhijit
|
|
|
|
|
Oh i'm Sorry i miss this link
thanks for ur help
Kareem Elhosseny
|
|
|
|
|
I am new. Let's first get that out of the way and even more so my asp/winforms 3 tier project is due tomorrow. Anyways I run the same code in winforms and get no exception, but in asp I do. All the code is in the first 2 tiers. It's really just 3 lines of code that go in asp or winforms.
The exception is as follows
Server Error in '/WebSite' Application.
--------------------------------------------------------------------------------
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
Line 21: {
Line 22: //System.Diagnostics.Debugger.Break();
Line 23: conStr = ConfigurationManager.ConnectionStrings[conStrName].ConnectionString;
Line 24: dbType = ConfigurationManager.ConnectionStrings[conStrName].ProviderName;
Line 25:
Source File: C:\prog\finalProject\BookStore\BookStoreDAL\DalClass.cs Line: 23
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.]
BookStoreDAL.DALClass..ctor(String conStrName) in C:\prog\finalProject\BookStore\BookStoreDAL\DalClass.cs:23
BookStoreBLL.BooksBLL..ctor(String conStr) in C:\prog\finalProject\BookStore\BookStoreBLL\BooksBLL.cs:16
Default2.Page_Load(Object sender, EventArgs e) in c:\prog\finalProject\BookStore\WebSite\allBooks.aspx.cs:20
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +33
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1436
In asp it looks like this
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using BookStoreBLL;
using System.Collections.Generic;
public partial class Default2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack)
return;
BooksBLL bll = new BooksBLL("C");
Book[] books = bll.allBooks();
GridView1.DataSource = books;
}
}
in winforms it looks like this
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using BookStoreBLL;
namespace BookStoreWindowsForms
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
BooksBLL bll = new BooksBLL("C");
Book[] books = bll.allBooks();
dataGridView1.DataSource = books;
}
}
}
I have some business logic that looks like this
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using BookStoreDAL;
using System.Data.Common;
namespace BookStoreBLL
{
public class BooksBLL
{
private DALClass dal;
public BooksBLL(string conStr)
{
dal = new DALClass(conStr);
}
public Book[] allBooks()
{
string sql = "SELECT * FROM Books";
List<book> allBooks = new List<book>();
dal.Open();
DbDataReader reader = dal.ExecuteReader(sql);
if (reader != null)
{
while (reader.Read())
{
Book book = new Book();
book.BookCode = (int)reader["ID"];
book.BookName = (string)reader["BookName"];
book.Publisher = (string)reader["Publisher"];
book.Price = (decimal)reader["price"];
book.BooksInStock = (int)reader["AmountInStock"];
}
reader.Close();
}
dal.Close();
return allBooks.ToArray();
}
}
}</book></book>
And then it goes to some data logic that looks like this
using System;
using System.Collections.Generic;
using System.Text;
using System.Data.SqlClient;
using System.Configuration;
using System.Data;
using System.Data.Common;
using System.Data.OleDb;
namespace BookStoreDAL
{
public class DALClass
{
private string conStr;
private DbConnection con;
private DbCommand com;
private string dbType;
public DALClass(string conStrName)
{
conStr = ConfigurationManager.ConnectionStrings[conStrName].ConnectionString;
dbType = ConfigurationManager.ConnectionStrings[conStrName].ProviderName;
if (dbType == "System.Data.SqlClient")
{
con = new SqlConnection(conStr);
com = new SqlCommand();
}
else if (dbType == "System.Data.OleDb")
{
con = new OleDbConnection(conStr);
com = new OleDbCommand();
}
com.Connection = con;
}
public bool Open()
{
try
{
if (con.State != ConnectionState.Open)
con.Open();
return true;
}
catch
{
return false;
}
}
public void Close()
{
con.Close();
}
public DbDataReader ExecuteReader(string sql)
{
try
{
com.CommandText = sql;
DbDataReader reader = com.ExecuteReader();
return reader;
}
catch
{
return null;
}
}
public bool ExecuteNonQuery(string sql)
{
try
{
com.CommandText = sql;
com.ExecuteNonQuery();
return true;
}
catch (Exception ex)
{
return false;
}
}
public DbDataReader ExecuteReader(DbParameter[] parameters, string sql)
{
try
{
com.CommandText = sql;
com.Parameters.AddRange(parameters);
DbDataReader reader = com.ExecuteReader();
com.Parameters.Clear();
return reader;
}
catch
{
return null;
}
}
public DbParameter CreateDbParameter(string name, object value)
{
DbParameter param = null;
if (dbType == "System.Data.SqlClient")
param = new SqlParameter();
else if (dbType == "System.Data.OleDb")
param = new OleDbParameter();
param.ParameterName = name;
param.Value = value;
return param;
}
}
}
Once again, there are no problems in in winforms and yet it i get this in asp. Any help would be greatly appreciated
|
|
|
|
|
I would guess that there are setting present in your app.config that are missing from your web.config vis-a-vis the connection string that you need.
|
|
|
|
|
and you were absolutely right. I forgot to put the connection string in my webconfig file. thx so much
|
|
|
|
|
Dear all...
I'm handling a login form, where let the user to login in pageA before entering pageB or pageC. When running at localhost, everything was fine.
Now the problem is when i put into the webserver. The session timeout within 30sec or less eventhough i had code :-
Session("Login") = userLogin in pageA
-
Session.Timeout = 60 (in pageB & pageC during pageload!)
If Session(Login) = Nothing Then
respone.redirect(PageA) Else ...............
Although I set the session timeout in web.config as well, it didn't work
Pls Help! many Thanks!
Nour Abdel-Salam...
A Trainer and a Web Developer in Jedda Int'l Computer Center(JICC)
|
|
|
|
|
There can be number of reasons for the behaviour.
Try using SessionMode as StateSever than InProc. As InProc is not reliable.
But make sure one thing that: ASP.net State Service is running on server.
|
|
|
|
|
Amandeep Singh Bhullar wrote: As InProc is not reliable.
I disagree. What made you to say it is not reliable?
|
|
|
|
|
The prime reason I've seen InProc session being lost is if the app pool is recycled, or IIS is reset because the process that holds the session is lost. With a state server or a state database the session is held outside the process meaning it survives these two events.
Also, if you have some daft bugger decide to configure a WebFarm to use InProc state then you will really have some interesting problems.
|
|
|
|
|
Colin Angus Mackay wrote: InProc session being lost is if the app pool is recycled, or IIS is reset because the process that holds the session is lost.
That's right. I have also seen antivirus programs making problems by scanning the configuration files and assemblies.
|
|
|
|
|
thanks 4 your reply...
i tried this
it gives me an error........
sessionState mode="StateServer"
stateConnectionString="tcpip=65.182.97.156:42424"
cookieless="false"
timeout="20"
thanx...
Nour Abdel-Salam...
A Trainer and a Web Developer in Jedda Int'l Computer Center(JICC)
|
|
|
|
|
nour123 wrote: it gives me an error........
What is the error, you have only detailed your configuration settings.
|
|
|
|
|
thanks 4 reply...
I wrote:
sessionState
mode="StateServer"
stateConnectionString="tcpip=127.0.0.1:42424"
cookieless="false"
timeout="20" /
the error is...
Unable to make the session state request to the session state server. Please ensure that the ASP.NET State service is started and that the client and server ports are the same. If the server is on a remote machine, please ensure that it accepts remote requests by checking the value of HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\aspnet_state\Parameters\AllowRemoteConnection. If the server is on the local machine, and if the before mentioned registry value does not exist or is set to 0, then the state server connection string must use either 'localhost' or '127.0.0.1' as the server name.
Nour Abdel-Salam...
A Trainer and a Web Developer in Jedda Int'l Computer Center(JICC)
|
|
|
|
|
Go to Run type
services.msc
and press enter
From the window select the service with name
ASP.NET State Service
Check its status. If it is not started, then Start this service.
This will solve your problem
|
|
|
|
|
nour123 wrote: The session timeout within 30sec or less eventhough i had code
Then you have some serious issues in your code. Are you sure the session is set correctly? Also try the points which I pointed out here[^]
|
|
|
|
|
|
nour123 wrote: why it works in my own iis, and doesn't work in the web host?
Because they are configured differently? Because it wasn't uploaded properly? Becuase the security context is different? Because you weren't actually using IIS on your machine? (A lot of people mistake Visual Studio's build in web server for IIS. It is different and it responds in subtly different ways)
Any number of reasons.
|
|
|
|